1
Fork 0

Make method and variable names more consistent

This commit is contained in:
varkor 2018-05-16 12:57:45 +01:00
parent 76c0d68745
commit f9d0968906
28 changed files with 183 additions and 164 deletions

View file

@ -1726,7 +1726,7 @@ impl<'a> LoweringContext<'a> {
hir::PathSegment::new( hir::PathSegment::new(
self.lower_ident(segment.ident), self.lower_ident(segment.ident),
generic_args, generic_args,
infer_types infer_types,
) )
} }
@ -1738,7 +1738,7 @@ impl<'a> LoweringContext<'a> {
) -> (hir::GenericArgs, bool) { ) -> (hir::GenericArgs, bool) {
let &AngleBracketedArgs { ref args, ref bindings, .. } = data; let &AngleBracketedArgs { ref args, ref bindings, .. } = data;
(hir::GenericArgs { (hir::GenericArgs {
args: args.iter().map(|p| self.lower_generic_arg(p, itctx)).collect(), args: args.iter().map(|a| self.lower_generic_arg(a, itctx)).collect(),
bindings: bindings.iter().map(|b| self.lower_ty_binding(b, itctx)).collect(), bindings: bindings.iter().map(|b| self.lower_ty_binding(b, itctx)).collect(),
parenthesized: false, parenthesized: false,
}, },

View file

@ -360,7 +360,7 @@ impl PathSegment {
// FIXME: hack required because you can't create a static // FIXME: hack required because you can't create a static
// GenericArgs, so you can't just return a &GenericArgs. // GenericArgs, so you can't just return a &GenericArgs.
pub fn with_args<F, R>(&self, f: F) -> R pub fn with_generic_args<F, R>(&self, f: F) -> R
where F: FnOnce(&GenericArgs) -> R where F: FnOnce(&GenericArgs) -> R
{ {
let dummy = GenericArgs::none(); let dummy = GenericArgs::none();

View file

@ -1269,11 +1269,11 @@ impl<'a> State<'a> {
self.s.word(".")?; self.s.word(".")?;
self.print_name(segment.name)?; self.print_name(segment.name)?;
segment.with_args(|args| { segment.with_generic_args(|generic_args| {
if !args.args.is_empty() || if !generic_args.args.is_empty() ||
!args.bindings.is_empty() !generic_args.bindings.is_empty()
{ {
self.print_generic_args(&args, segment.infer_types, true) self.print_generic_args(&generic_args, segment.infer_types, true)
} else { } else {
Ok(()) Ok(())
} }
@ -1641,10 +1641,10 @@ impl<'a> State<'a> {
if segment.name != keywords::CrateRoot.name() && if segment.name != keywords::CrateRoot.name() &&
segment.name != keywords::DollarCrate.name() { segment.name != keywords::DollarCrate.name() {
self.print_name(segment.name)?; self.print_name(segment.name)?;
segment.with_args(|parameters| { segment.with_generic_args(|generic_args| {
self.print_generic_args(parameters, self.print_generic_args(generic_args,
segment.infer_types, segment.infer_types,
colons_before_params) colons_before_params)
})?; })?;
} }
} }
@ -1673,10 +1673,10 @@ impl<'a> State<'a> {
if segment.name != keywords::CrateRoot.name() && if segment.name != keywords::CrateRoot.name() &&
segment.name != keywords::DollarCrate.name() { segment.name != keywords::DollarCrate.name() {
self.print_name(segment.name)?; self.print_name(segment.name)?;
segment.with_args(|parameters| { segment.with_generic_args(|generic_args| {
self.print_generic_args(parameters, self.print_generic_args(generic_args,
segment.infer_types, segment.infer_types,
colons_before_params) colons_before_params)
})?; })?;
} }
} }
@ -1685,10 +1685,10 @@ impl<'a> State<'a> {
self.s.word("::")?; self.s.word("::")?;
let item_segment = path.segments.last().unwrap(); let item_segment = path.segments.last().unwrap();
self.print_name(item_segment.name)?; self.print_name(item_segment.name)?;
item_segment.with_args(|parameters| { item_segment.with_generic_args(|generic_args| {
self.print_generic_args(parameters, self.print_generic_args(generic_args,
item_segment.infer_types, item_segment.infer_types,
colons_before_params) colons_before_params)
}) })
} }
hir::QPath::TypeRelative(ref qself, ref item_segment) => { hir::QPath::TypeRelative(ref qself, ref item_segment) => {
@ -1697,10 +1697,10 @@ impl<'a> State<'a> {
self.s.word(">")?; self.s.word(">")?;
self.s.word("::")?; self.s.word("::")?;
self.print_name(item_segment.name)?; self.print_name(item_segment.name)?;
item_segment.with_args(|parameters| { item_segment.with_generic_args(|generic_args| {
self.print_generic_args(parameters, self.print_generic_args(generic_args,
item_segment.infer_types, item_segment.infer_types,
colons_before_params) colons_before_params)
}) })
} }
} }
@ -1734,11 +1734,11 @@ impl<'a> State<'a> {
let elide_lifetimes = generic_args.lifetimes().all(|lt| lt.is_elided()); let elide_lifetimes = generic_args.lifetimes().all(|lt| lt.is_elided());
if !elide_lifetimes { if !elide_lifetimes {
start_or_comma(self)?; start_or_comma(self)?;
self.commasep(Inconsistent, &generic_args.args, |s, p| { self.commasep(Inconsistent, &generic_args.args, |s, generic_arg| {
match p { match generic_arg {
GenericArg::Lifetime(lt) => s.print_lifetime(lt), GenericArg::Lifetime(lt) => s.print_lifetime(lt),
GenericArg::Type(ty) => s.print_type(ty), GenericArg::Type(ty) => s.print_type(ty),
} }
})?; })?;
} else if generic_args.types().count() != 0 { } else if generic_args.types().count() != 0 {
start_or_comma(self)?; start_or_comma(self)?;

View file

@ -1601,20 +1601,21 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
&mut self, &mut self,
def: Def, def: Def,
depth: usize, depth: usize,
args: &'tcx hir::GenericArgs, generic_args: &'tcx hir::GenericArgs,
) { ) {
if args.parenthesized { if generic_args.parenthesized {
let was_in_fn_syntax = self.is_in_fn_syntax; let was_in_fn_syntax = self.is_in_fn_syntax;
self.is_in_fn_syntax = true; self.is_in_fn_syntax = true;
self.visit_fn_like_elision(args.inputs(), Some(&args.bindings[0].ty)); self.visit_fn_like_elision(generic_args.inputs(),
Some(&generic_args.bindings[0].ty));
self.is_in_fn_syntax = was_in_fn_syntax; self.is_in_fn_syntax = was_in_fn_syntax;
return; return;
} }
if args.lifetimes().all(|l| l.is_elided()) { if generic_args.lifetimes().all(|l| l.is_elided()) {
self.resolve_elided_lifetimes(args.lifetimes().collect(), true); self.resolve_elided_lifetimes(generic_args.lifetimes().collect(), true);
} else { } else {
for l in args.lifetimes() { for l in generic_args.lifetimes() {
self.visit_lifetime(l); self.visit_lifetime(l);
} }
} }
@ -1686,13 +1687,13 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
} else { } else {
Some(Region::Static) Some(Region::Static)
}, },
Set1::One(r) => r.subst(args.lifetimes(), map), Set1::One(r) => r.subst(generic_args.lifetimes(), map),
Set1::Many => None, Set1::Many => None,
}) })
.collect() .collect()
}); });
for (i, ty) in args.types().enumerate() { for (i, ty) in generic_args.types().enumerate() {
if let Some(&lt) = object_lifetime_defaults.get(i) { if let Some(&lt) = object_lifetime_defaults.get(i) {
let scope = Scope::ObjectLifetimeDefault { let scope = Scope::ObjectLifetimeDefault {
lifetime: lt, lifetime: lt,
@ -1704,7 +1705,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
} }
} }
for b in &args.bindings { for b in &generic_args.bindings {
self.visit_assoc_type_binding(b); self.visit_assoc_type_binding(b);
} }
} }

View file

@ -10,7 +10,6 @@
use hir::def_id::DefId; use hir::def_id::DefId;
use ty::{self, Ty, TypeFoldable, Substs, TyCtxt}; use ty::{self, Ty, TypeFoldable, Substs, TyCtxt};
use ty::subst::Kind;
use traits; use traits;
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
use util::ppaux; use util::ppaux;

View file

@ -105,10 +105,6 @@ impl<'tcx> From<Ty<'tcx>> for Kind<'tcx> {
} }
} }
impl<'tcx> Into<Kind<'tcx>> for ty::Region<'tcx> {}
impl<'tcx> Into<Kind<'tcx>> for Ty<'tcx> {}
impl<'tcx> Kind<'tcx> { impl<'tcx> Kind<'tcx> {
#[inline] #[inline]
pub fn unpack(self) -> UnpackedKind<'tcx> { pub fn unpack(self) -> UnpackedKind<'tcx> {

View file

@ -40,7 +40,6 @@ use rustc::middle::weak_lang_items;
use rustc::mir::mono::{Linkage, Visibility, Stats}; use rustc::mir::mono::{Linkage, Visibility, Stats};
use rustc::middle::cstore::{EncodedMetadata}; use rustc::middle::cstore::{EncodedMetadata};
use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::Kind;
use rustc::ty::layout::{self, Align, TyLayout, LayoutOf}; use rustc::ty::layout::{self, Align, TyLayout, LayoutOf};
use rustc::ty::query::Providers; use rustc::ty::query::Providers;
use rustc::dep_graph::{DepNode, DepConstructor}; use rustc::dep_graph::{DepNode, DepConstructor};

View file

@ -677,7 +677,7 @@ impl<'a> ReplaceBodyWithLoop<'a> {
ast::TyKind::Paren(ref subty) => involves_impl_trait(subty), ast::TyKind::Paren(ref subty) => involves_impl_trait(subty),
ast::TyKind::Tup(ref tys) => any_involves_impl_trait(tys.iter()), ast::TyKind::Tup(ref tys) => any_involves_impl_trait(tys.iter()),
ast::TyKind::Path(_, ref path) => path.segments.iter().any(|seg| { ast::TyKind::Path(_, ref path) => path.segments.iter().any(|seg| {
match seg.args.as_ref().map(|p| &**p) { match seg.args.as_ref().map(|generic_arg| &**generic_arg) {
None => false, None => false,
Some(&ast::GenericArgs::AngleBracketed(ref data)) => Some(&ast::GenericArgs::AngleBracketed(ref data)) =>
any_involves_impl_trait(data.types().into_iter()) || any_involves_impl_trait(data.types().into_iter()) ||

View file

@ -13,7 +13,6 @@ use rustc::middle::lang_items::DropInPlaceFnLangItem;
use rustc::traits; use rustc::traits;
use rustc::ty::adjustment::CustomCoerceUnsized; use rustc::ty::adjustment::CustomCoerceUnsized;
use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::Kind;
pub use rustc::ty::Instance; pub use rustc::ty::Instance;
pub use self::item::{MonoItem, MonoItemExt}; pub use self::item::{MonoItem, MonoItemExt};

View file

@ -523,21 +523,21 @@ impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> {
} }
fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) { fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) {
match *generic_args { match *generic_args {
GenericArgs::AngleBracketed(ref params) => { GenericArgs::AngleBracketed(ref generic_args) => {
for type_ in params.types() { for type_ in generic_args.types() {
self.visit_ty(type_); self.visit_ty(type_);
} }
for type_binding in &params.bindings { for type_binding in &generic_args.bindings {
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>` // Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
// are allowed to contain nested `impl Trait`. // are allowed to contain nested `impl Trait`.
self.with_impl_trait(None, |this| visit::walk_ty(this, &type_binding.ty)); self.with_impl_trait(None, |this| visit::walk_ty(this, &type_binding.ty));
} }
} }
GenericArgs::Parenthesized(ref params) => { GenericArgs::Parenthesized(ref generic_args) => {
for type_ in &params.inputs { for type_ in &generic_args.inputs {
self.visit_ty(type_); self.visit_ty(type_);
} }
if let Some(ref type_) = params.output { if let Some(ref type_) = generic_args.output {
// `-> Foo` syntax is essentially an associated type binding, // `-> Foo` syntax is essentially an associated type binding,
// so it is also allowed to contain nested `impl Trait`. // so it is also allowed to contain nested `impl Trait`.
self.with_impl_trait(None, |this| visit::walk_ty(this, type_)); self.with_impl_trait(None, |this| visit::walk_ty(this, type_));

View file

@ -820,8 +820,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
// Type arguments // Type arguments
for seg in &path.segments { for seg in &path.segments {
if let Some(ref args) = seg.args { if let Some(ref generic_args) = seg.args {
match **args { match **generic_args {
ast::GenericArgs::AngleBracketed(ref data) => for t in data.types() { ast::GenericArgs::AngleBracketed(ref data) => for t in data.types() {
self.visit_ty(t); self.visit_ty(t);
}, },
@ -905,8 +905,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
} }
// Explicit types in the turbo-fish. // Explicit types in the turbo-fish.
if let Some(ref args) = seg.args { if let Some(ref generic_args) = seg.args {
if let ast::GenericArgs::AngleBracketed(ref data) = **args { if let ast::GenericArgs::AngleBracketed(ref data) = **generic_args {
for t in data.types() { for t in data.types() {
self.visit_ty(t); self.visit_ty(t);
} }

View file

@ -692,8 +692,8 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
if path.segments.len() != 1 { if path.segments.len() != 1 {
return false; return false;
} }
if let Some(ref args) = path.segments[0].args { if let Some(ref generic_args) = path.segments[0].args {
if let ast::GenericArgs::Parenthesized(_) = **args { if let ast::GenericArgs::Parenthesized(_) = **generic_args {
return true; return true;
} }
} }

View file

@ -177,11 +177,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
{ {
let (substs, assoc_bindings) = let (substs, assoc_bindings) =
item_segment.with_args(|args| { item_segment.with_generic_args(|generic_args| {
self.create_substs_for_ast_path( self.create_substs_for_ast_path(
span, span,
def_id, def_id,
args, generic_args,
item_segment.infer_types, item_segment.infer_types,
None) None)
}); });
@ -199,7 +199,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
fn create_substs_for_ast_path(&self, fn create_substs_for_ast_path(&self,
span: Span, span: Span,
def_id: DefId, def_id: DefId,
args: &hir::GenericArgs, generic_args: &hir::GenericArgs,
infer_types: bool, infer_types: bool,
self_ty: Option<Ty<'tcx>>) self_ty: Option<Ty<'tcx>>)
-> (&'tcx Substs<'tcx>, Vec<ConvertedBinding<'tcx>>) -> (&'tcx Substs<'tcx>, Vec<ConvertedBinding<'tcx>>)
@ -207,15 +207,15 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
let tcx = self.tcx(); let tcx = self.tcx();
debug!("create_substs_for_ast_path(def_id={:?}, self_ty={:?}, \ debug!("create_substs_for_ast_path(def_id={:?}, self_ty={:?}, \
args={:?})", generic_args={:?})",
def_id, self_ty, args); def_id, self_ty, generic_args);
// If the type is parameterized by this region, then replace this // If the type is parameterized by this region, then replace this
// region with the current anon region binding (in other words, // region with the current anon region binding (in other words,
// whatever & would get replaced with). // whatever & would get replaced with).
let decl_generics = tcx.generics_of(def_id); let decl_generics = tcx.generics_of(def_id);
let ty_provided = args.types().count(); let ty_provided = generic_args.types().count();
let lt_provided = args.lifetimes().count(); let lt_provided = generic_args.lifetimes().count();
let mut lt_accepted = 0; let mut lt_accepted = 0;
let mut ty_params = ParamRange { required: 0, accepted: 0 }; let mut ty_params = ParamRange { required: 0, accepted: 0 };
@ -269,7 +269,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
match param.kind { match param.kind {
GenericParamDefKind::Lifetime => { GenericParamDefKind::Lifetime => {
let i = param.index as usize - own_self; let i = param.index as usize - own_self;
if let Some(lifetime) = args.lifetimes().nth(i) { if let Some(lifetime) = generic_args.lifetimes().nth(i) {
self.ast_region_to_region(lifetime, Some(param)).into() self.ast_region_to_region(lifetime, Some(param)).into()
} else { } else {
tcx.types.re_static.into() tcx.types.re_static.into()
@ -286,7 +286,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
let i = i - (lt_accepted + own_self); let i = i - (lt_accepted + own_self);
if i < ty_provided { if i < ty_provided {
// A provided type parameter. // A provided type parameter.
self.ast_ty_to_ty(&args.types().nth(i).unwrap()).into() self.ast_ty_to_ty(&generic_args.types().nth(i).unwrap()).into()
} else if infer_types { } else if infer_types {
// No type parameters were provided, we can infer all. // No type parameters were provided, we can infer all.
if !default_needs_object_self(param) { if !default_needs_object_self(param) {
@ -330,7 +330,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
} }
}); });
let assoc_bindings = args.bindings.iter().map(|binding| { let assoc_bindings = generic_args.bindings.iter().map(|binding| {
ConvertedBinding { ConvertedBinding {
item_name: binding.name, item_name: binding.name,
ty: self.ast_ty_to_ty(&binding.ty), ty: self.ast_ty_to_ty(&binding.ty),
@ -451,7 +451,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
let trait_def = self.tcx().trait_def(trait_def_id); let trait_def = self.tcx().trait_def(trait_def_id);
if !self.tcx().features().unboxed_closures && if !self.tcx().features().unboxed_closures &&
trait_segment.with_args(|p| p.parenthesized) != trait_def.paren_sugar { trait_segment.with_generic_args(|generic_args| generic_args.parenthesized)
!= trait_def.paren_sugar {
// For now, require that parenthetical notation be used only with `Fn()` etc. // For now, require that parenthetical notation be used only with `Fn()` etc.
let msg = if trait_def.paren_sugar { let msg = if trait_def.paren_sugar {
"the precise format of `Fn`-family traits' type parameters is subject to change. \ "the precise format of `Fn`-family traits' type parameters is subject to change. \
@ -463,10 +464,10 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
span, GateIssue::Language, msg); span, GateIssue::Language, msg);
} }
trait_segment.with_args(|parameters| { trait_segment.with_generic_args(|generic_args| {
self.create_substs_for_ast_path(span, self.create_substs_for_ast_path(span,
trait_def_id, trait_def_id,
parameters, generic_args,
trait_segment.infer_types, trait_segment.infer_types,
Some(self_ty)) Some(self_ty))
}) })
@ -970,27 +971,36 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
pub fn prohibit_type_params(&self, segments: &[hir::PathSegment]) { pub fn prohibit_type_params(&self, segments: &[hir::PathSegment]) {
for segment in segments { for segment in segments {
segment.with_args(|params| { segment.with_generic_args(|generic_args| {
for p in &params.args { let mut err_for_lifetime = false;
let (mut span_err, span, kind) = match p { let mut err_for_type = false;
for arg in &generic_args.args {
let (mut span_err, span, kind) = match arg {
hir::GenericArg::Lifetime(lt) => { hir::GenericArg::Lifetime(lt) => {
if err_for_lifetime { continue }
err_for_lifetime = true;
(struct_span_err!(self.tcx().sess, lt.span, E0110, (struct_span_err!(self.tcx().sess, lt.span, E0110,
"lifetime parameters are not allowed on this type"), "lifetime parameters are not allowed on \
this type"),
lt.span, lt.span,
"lifetime") "lifetime")
} }
hir::GenericArg::Type(ty) => { hir::GenericArg::Type(ty) => {
if err_for_type { continue }
err_for_type = true;
(struct_span_err!(self.tcx().sess, ty.span, E0109, (struct_span_err!(self.tcx().sess, ty.span, E0109,
"type parameters are not allowed on this type"), "type parameters are not allowed on this type"),
ty.span, ty.span,
"type") "type")
} }
}; };
span_err.span_label(span, format!("{} parameter not allowed", kind)) span_err.span_label(span, format!("{} parameter not allowed", kind))
.emit(); .emit();
break; if err_for_lifetime && err_for_type {
break;
}
} }
for binding in &params.bindings { for binding in &generic_args.bindings {
self.prohibit_projection(binding.span); self.prohibit_projection(binding.span);
break; break;
} }

View file

@ -4834,7 +4834,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
match param.kind { match param.kind {
GenericParamDefKind::Lifetime => { GenericParamDefKind::Lifetime => {
let lifetimes = segment.map_or(vec![], |(s, _)| { let lifetimes = segment.map_or(vec![], |(s, _)| {
s.args.as_ref().map_or(vec![], |p| p.lifetimes().collect()) s.args.as_ref().map_or(vec![], |arg| arg.lifetimes().collect())
}); });
if let Some(lifetime) = lifetimes.get(i) { if let Some(lifetime) = lifetimes.get(i) {
@ -4845,7 +4845,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
} }
GenericParamDefKind::Type {..} => { GenericParamDefKind::Type {..} => {
let (types, infer_types) = segment.map_or((vec![], true), |(s, _)| { let (types, infer_types) = segment.map_or((vec![], true), |(s, _)| {
(s.args.as_ref().map_or(vec![], |p| p.types().collect()), s.infer_types) (s.args.as_ref().map_or(vec![], |arg| {
arg.types().collect()
}), s.infer_types)
}); });
// Skip over the lifetimes in the same segment. // Skip over the lifetimes in the same segment.
@ -4956,16 +4958,23 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
/// Report errors if the provided parameters are too few or too many. /// Report errors if the provided parameters are too few or too many.
fn check_generic_arg_count(&self, fn check_generic_arg_count(&self,
span: Span, span: Span,
segment: &mut Option<(&hir::PathSegment, &ty::Generics)>, segment: &mut Option<(&hir::PathSegment, &ty::Generics)>,
is_method_call: bool, is_method_call: bool,
supress_mismatch_error: bool) { supress_mismatch_error: bool) {
let (lifetimes, types, infer_types, bindings) = segment.map_or( let (lifetimes, types, infer_types, bindings) = segment.map_or(
(vec![], vec![], true, &[][..]), (vec![], vec![], true, &[][..]),
|(s, _)| s.args.as_ref().map_or( |(s, _)| {
(vec![], vec![], s.infer_types, &[][..]), s.args.as_ref().map_or(
|p| (p.lifetimes().collect(), p.types().collect(), (vec![], vec![], s.infer_types, &[][..]),
s.infer_types, &p.bindings[..]))); |arg| {
(arg.lifetimes().collect(),
arg.types().collect(),
s.infer_types,
&arg.bindings[..])
}
)
});
let infer_lifetimes = lifetimes.len() == 0; let infer_lifetimes = lifetimes.len() == 0;
let count_lifetime_params = |n| { let count_lifetime_params = |n| {

View file

@ -2851,7 +2851,7 @@ impl Clean<Type> for hir::Ty {
let provided_params = &path.segments.last().unwrap(); let provided_params = &path.segments.last().unwrap();
let mut ty_substs = FxHashMap(); let mut ty_substs = FxHashMap();
let mut lt_substs = FxHashMap(); let mut lt_substs = FxHashMap();
provided_params.with_args(|provided_params| { provided_params.with_generic_args(|generic_args| {
let mut indices = GenericParamCount { let mut indices = GenericParamCount {
lifetimes: 0, lifetimes: 0,
types: 0 types: 0
@ -2859,7 +2859,7 @@ impl Clean<Type> for hir::Ty {
for param in generics.params.iter() { for param in generics.params.iter() {
match param { match param {
hir::GenericParam::Lifetime(lt_param) => { hir::GenericParam::Lifetime(lt_param) => {
if let Some(lt) = provided_params.lifetimes() if let Some(lt) = generic_args.lifetimes()
.nth(indices.lifetimes).cloned() { .nth(indices.lifetimes).cloned() {
if !lt.is_elided() { if !lt.is_elided() {
let lt_def_id = let lt_def_id =
@ -2872,7 +2872,7 @@ impl Clean<Type> for hir::Ty {
hir::GenericParam::Type(ty_param) => { hir::GenericParam::Type(ty_param) => {
let ty_param_def = let ty_param_def =
Def::TyParam(cx.tcx.hir.local_def_id(ty_param.id)); Def::TyParam(cx.tcx.hir.local_def_id(ty_param.id));
if let Some(ty) = provided_params.types() if let Some(ty) = generic_args.types()
.nth(indices.types).cloned() { .nth(indices.types).cloned() {
ty_substs.insert(ty_param_def, ty.into_inner().clean(cx)); ty_substs.insert(ty_param_def, ty.into_inner().clean(cx));
} else if let Some(default) = ty_param.default.clone() { } else if let Some(default) = ty_param.default.clone() {
@ -3497,9 +3497,9 @@ impl Clean<GenericArgs> for hir::GenericArgs {
lifetimes: if self.lifetimes().all(|lt| lt.is_elided()) { lifetimes: if self.lifetimes().all(|lt| lt.is_elided()) {
vec![] vec![]
} else { } else {
self.lifetimes().map(|lp| lp.clean(cx)).collect() self.lifetimes().map(|lt| lt.clean(cx)).collect()
}, },
types: self.types().map(|tp| tp.clean(cx)).collect(), types: self.types().map(|ty| ty.clean(cx)).collect(),
bindings: self.bindings.clean(cx), bindings: self.bindings.clean(cx),
} }
} }
@ -3516,7 +3516,7 @@ impl Clean<PathSegment> for hir::PathSegment {
fn clean(&self, cx: &DocContext) -> PathSegment { fn clean(&self, cx: &DocContext) -> PathSegment {
PathSegment { PathSegment {
name: self.name.clean(cx), name: self.name.clean(cx),
args: self.with_args(|args| args.clean(cx)) args: self.with_generic_args(|generic_args| generic_args.clean(cx))
} }
} }
} }

View file

@ -188,8 +188,8 @@ pub struct AngleBracketedArgs {
impl AngleBracketedArgs { impl AngleBracketedArgs {
pub fn lifetimes(&self) -> impl DoubleEndedIterator<Item = &Lifetime> { pub fn lifetimes(&self) -> impl DoubleEndedIterator<Item = &Lifetime> {
self.args.iter().filter_map(|p| { self.args.iter().filter_map(|arg| {
if let GenericArg::Lifetime(lt) = p { if let GenericArg::Lifetime(lt) = arg {
Some(lt) Some(lt)
} else { } else {
None None
@ -198,8 +198,8 @@ impl AngleBracketedArgs {
} }
pub fn types(&self) -> impl DoubleEndedIterator<Item = &P<Ty>> { pub fn types(&self) -> impl DoubleEndedIterator<Item = &P<Ty>> {
self.args.iter().filter_map(|p| { self.args.iter().filter_map(|arg| {
if let GenericArg::Type(ty) = p { if let GenericArg::Type(ty) = arg {
Some(ty) Some(ty)
} else { } else {
None None

View file

@ -31,7 +31,7 @@ pub trait AstBuilder {
fn path_all(&self, sp: Span, fn path_all(&self, sp: Span,
global: bool, global: bool,
idents: Vec<ast::Ident>, idents: Vec<ast::Ident>,
parameters: Vec<ast::GenericArg>, args: Vec<ast::GenericArg>,
bindings: Vec<ast::TypeBinding>) bindings: Vec<ast::TypeBinding>)
-> ast::Path; -> ast::Path;
@ -42,7 +42,7 @@ pub trait AstBuilder {
fn qpath_all(&self, self_type: P<ast::Ty>, fn qpath_all(&self, self_type: P<ast::Ty>,
trait_path: ast::Path, trait_path: ast::Path,
ident: ast::Ident, ident: ast::Ident,
parameters: Vec<ast::GenericArg>, args: Vec<ast::GenericArg>,
bindings: Vec<ast::TypeBinding>) bindings: Vec<ast::TypeBinding>)
-> (ast::QSelf, ast::Path); -> (ast::QSelf, ast::Path);
@ -302,13 +302,13 @@ pub trait AstBuilder {
impl<'a> AstBuilder for ExtCtxt<'a> { impl<'a> AstBuilder for ExtCtxt<'a> {
fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path { fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
self.path_all(span, false, strs, Vec::new(), Vec::new()) self.path_all(span, false, strs, vec![], vec![])
} }
fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path { fn path_ident(&self, span: Span, id: ast::Ident) -> ast::Path {
self.path(span, vec![id]) self.path(span, vec![id])
} }
fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path { fn path_global(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
self.path_all(span, true, strs, Vec::new(), Vec::new()) self.path_all(span, true, strs, vec![], vec![])
} }
fn path_all(&self, fn path_all(&self,
span: Span, span: Span,
@ -318,7 +318,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
bindings: Vec<ast::TypeBinding> ) bindings: Vec<ast::TypeBinding> )
-> ast::Path { -> ast::Path {
let last_ident = idents.pop().unwrap(); let last_ident = idents.pop().unwrap();
let mut segments: Vec<ast::PathSegment> = Vec::new(); let mut segments: Vec<ast::PathSegment> = vec![];
segments.extend(idents.into_iter().map(|ident| { segments.extend(idents.into_iter().map(|ident| {
ast::PathSegment::from_ident(ident.with_span_pos(span)) ast::PathSegment::from_ident(ident.with_span_pos(span))
@ -424,7 +424,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
self.path_all(DUMMY_SP, self.path_all(DUMMY_SP,
true, true,
self.std_path(&["option", "Option"]), self.std_path(&["option", "Option"]),
vec![ ast::GenericArg::Type(ty) ], vec![ast::GenericArg::Type(ty)],
Vec::new())) Vec::new()))
} }

View file

@ -132,10 +132,9 @@ pub trait Folder : Sized {
noop_fold_exprs(es, self) noop_fold_exprs(es, self)
} }
fn fold_param(&mut self, p: GenericArg) -> GenericArg { fn fold_generic_arg(&mut self, arg: GenericArg) -> GenericArg {
match p { match arg {
GenericArg::Lifetime(lt) => GenericArg::Lifetime(lt) => GenericArg::Lifetime(self.fold_lifetime(lt)),
GenericArg::Lifetime(self.fold_lifetime(lt)),
GenericArg::Type(ty) => GenericArg::Type(self.fold_ty(ty)), GenericArg::Type(ty) => GenericArg::Type(self.fold_ty(ty)),
} }
} }
@ -441,9 +440,9 @@ pub fn noop_fold_usize<T: Folder>(i: usize, _: &mut T) -> usize {
pub fn noop_fold_path<T: Folder>(Path { segments, span }: Path, fld: &mut T) -> Path { pub fn noop_fold_path<T: Folder>(Path { segments, span }: Path, fld: &mut T) -> Path {
Path { Path {
segments: segments.move_map(|PathSegment {ident, args}| PathSegment { segments: segments.move_map(|PathSegment { ident, args }| PathSegment {
ident: fld.fold_ident(ident), ident: fld.fold_ident(ident),
args: args.map(|ps| ps.map(|ps| fld.fold_generic_args(ps))), args: args.map(|args| args.map(|args| fld.fold_generic_args(args))),
}), }),
span: fld.new_span(span) span: fld.new_span(span)
} }
@ -462,14 +461,15 @@ pub fn noop_fold_qpath<T: Folder>(qself: Option<QSelf>,
(qself, fld.fold_path(path)) (qself, fld.fold_path(path))
} }
pub fn noop_fold_generic_args<T: Folder>(generic_args: GenericArgs, fld: &mut T) pub fn noop_fold_generic_args<T: Folder>(generic_args: GenericArgs, fld: &mut T) -> GenericArgs
-> GenericArgs
{ {
match generic_args { match generic_args {
GenericArgs::AngleBracketed(data) => GenericArgs::AngleBracketed(data) => {
GenericArgs::AngleBracketed(fld.fold_angle_bracketed_parameter_data(data)), GenericArgs::AngleBracketed(fld.fold_angle_bracketed_parameter_data(data))
GenericArgs::Parenthesized(data) => }
GenericArgs::Parenthesized(fld.fold_parenthesized_parameter_data(data)), GenericArgs::Parenthesized(data) => {
GenericArgs::Parenthesized(fld.fold_parenthesized_parameter_data(data))
}
} }
} }
@ -478,9 +478,11 @@ pub fn noop_fold_angle_bracketed_parameter_data<T: Folder>(data: AngleBracketedA
-> AngleBracketedArgs -> AngleBracketedArgs
{ {
let AngleBracketedArgs { args, bindings, span } = data; let AngleBracketedArgs { args, bindings, span } = data;
AngleBracketedArgs { args: args.move_map(|p| fld.fold_param(p)), AngleBracketedArgs {
bindings: bindings.move_map(|b| fld.fold_ty_binding(b)), args: args.move_map(|arg| fld.fold_generic_arg(arg)),
span: fld.new_span(span) } bindings: bindings.move_map(|b| fld.fold_ty_binding(b)),
span: fld.new_span(span)
}
} }
pub fn noop_fold_parenthesized_parameter_data<T: Folder>(data: ParenthesizedArgData, pub fn noop_fold_parenthesized_parameter_data<T: Folder>(data: ParenthesizedArgData,
@ -488,9 +490,11 @@ pub fn noop_fold_parenthesized_parameter_data<T: Folder>(data: ParenthesizedArgD
-> ParenthesizedArgData -> ParenthesizedArgData
{ {
let ParenthesizedArgData { inputs, output, span } = data; let ParenthesizedArgData { inputs, output, span } = data;
ParenthesizedArgData { inputs: inputs.move_map(|ty| fld.fold_ty(ty)), ParenthesizedArgData {
output: output.map(|ty| fld.fold_ty(ty)), inputs: inputs.move_map(|ty| fld.fold_ty(ty)),
span: fld.new_span(span) } output: output.map(|ty| fld.fold_ty(ty)),
span: fld.new_span(span)
}
} }
pub fn noop_fold_local<T: Folder>(l: P<Local>, fld: &mut T) -> P<Local> { pub fn noop_fold_local<T: Folder>(l: P<Local>, fld: &mut T) -> P<Local> {
@ -1191,8 +1195,8 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu
ExprKind::MethodCall( ExprKind::MethodCall(
PathSegment { PathSegment {
ident: folder.fold_ident(seg.ident), ident: folder.fold_ident(seg.ident),
args: seg.args.map(|ps| { args: seg.args.map(|args| {
ps.map(|ps| folder.fold_generic_args(ps)) args.map(|args| folder.fold_generic_args(args))
}), }),
}, },
folder.fold_exprs(args)) folder.fold_exprs(args))

View file

@ -1017,8 +1017,8 @@ impl<'a> State<'a> {
Ok(()) Ok(())
} }
pub fn print_param(&mut self, param: &GenericArg) -> io::Result<()> { pub fn print_generic_arg(&mut self, generic_arg: &GenericArg) -> io::Result<()> {
match param { match generic_arg {
GenericArg::Lifetime(lt) => self.print_lifetime(lt), GenericArg::Lifetime(lt) => self.print_lifetime(lt),
GenericArg::Type(ty) => self.print_type(ty), GenericArg::Type(ty) => self.print_type(ty),
} }
@ -2469,9 +2469,9 @@ impl<'a> State<'a> {
} }
fn print_generic_args(&mut self, fn print_generic_args(&mut self,
args: &ast::GenericArgs, args: &ast::GenericArgs,
colons_before_params: bool) colons_before_params: bool)
-> io::Result<()> -> io::Result<()>
{ {
if colons_before_params { if colons_before_params {
self.s.word("::")? self.s.word("::")?
@ -2481,7 +2481,9 @@ impl<'a> State<'a> {
ast::GenericArgs::AngleBracketed(ref data) => { ast::GenericArgs::AngleBracketed(ref data) => {
self.s.word("<")?; self.s.word("<")?;
self.commasep(Inconsistent, &data.args, |s, p| s.print_param(p))?; self.commasep(Inconsistent, &data.args, |s, generic_arg| {
s.print_generic_arg(generic_arg)
})?;
let mut comma = data.args.len() != 0; let mut comma = data.args.len() != 0;

View file

@ -131,8 +131,8 @@ pub trait Visitor<'ast>: Sized {
fn visit_generic_args(&mut self, path_span: Span, generic_args: &'ast GenericArgs) { fn visit_generic_args(&mut self, path_span: Span, generic_args: &'ast GenericArgs) {
walk_generic_args(self, path_span, generic_args) walk_generic_args(self, path_span, generic_args)
} }
fn visit_angle_bracketed_param(&mut self, param: &'ast GenericArg) { fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg) {
match param { match generic_arg {
GenericArg::Lifetime(lt) => self.visit_lifetime(lt), GenericArg::Lifetime(lt) => self.visit_lifetime(lt),
GenericArg::Type(ty) => self.visit_ty(ty), GenericArg::Type(ty) => self.visit_ty(ty),
} }
@ -393,7 +393,7 @@ pub fn walk_generic_args<'a, V>(visitor: &mut V,
{ {
match *generic_args { match *generic_args {
GenericArgs::AngleBracketed(ref data) => { GenericArgs::AngleBracketed(ref data) => {
walk_list!(visitor, visit_angle_bracketed_param, &data.args); walk_list!(visitor, visit_generic_arg, &data.args);
walk_list!(visitor, visit_assoc_type_binding, &data.bindings); walk_list!(visitor, visit_assoc_type_binding, &data.bindings);
} }
GenericArgs::Parenthesized(ref data) => { GenericArgs::Parenthesized(ref data) => {

View file

@ -2,7 +2,7 @@ error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/E0110.rs:11:14 --> $DIR/E0110.rs:11:14
| |
LL | type X = u32<'static>; //~ ERROR E0110 LL | type X = u32<'static>; //~ ERROR E0110
| ^^^^^^^ lifetime parameter not allowed on this type | ^^^^^^^ lifetime parameter not allowed
error: aborting due to previous error error: aborting due to previous error

View file

@ -20,13 +20,13 @@ error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/collections.rs:33:50 --> $DIR/collections.rs:33:50
| |
LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>; LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>;
| ^^^^^ lifetime parameter not allowed on this type | ^^^^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/collections.rs:59:50 --> $DIR/collections.rs:59:50
| |
LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> { LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> {
| ^^^^^ lifetime parameter not allowed on this type | ^^^^^ lifetime parameter not allowed
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -2,19 +2,19 @@ error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/construct_with_other_type.rs:26:46 --> $DIR/construct_with_other_type.rs:26:46
| |
LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>;
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/construct_with_other_type.rs:26:63 --> $DIR/construct_with_other_type.rs:26:63
| |
LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>; LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>;
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/construct_with_other_type.rs:34:40 --> $DIR/construct_with_other_type.rs:34:40
| |
LL | type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>; LL | type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>;
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -14,19 +14,19 @@ error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:20:47 --> $DIR/generic_associated_type_undeclared_lifetimes.rs:20:47
| |
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>> LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:22:37 --> $DIR/generic_associated_type_undeclared_lifetimes.rs:22:37
| |
LL | + Deref<Target = Self::Item<'b>>; LL | + Deref<Target = Self::Item<'b>>;
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:26:41 --> $DIR/generic_associated_type_undeclared_lifetimes.rs:26:41
| |
LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
| ^^^^^^^^^^^ lifetime parameter not allowed on this type | ^^^^^^^^^^^ lifetime parameter not allowed
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -2,37 +2,37 @@ error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:20:47 --> $DIR/iterable.rs:20:47
| |
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>; LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>;
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:49:53 --> $DIR/iterable.rs:49:53
| |
LL | fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { LL | fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> {
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:54:60 --> $DIR/iterable.rs:54:60
| |
LL | fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> { LL | fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> {
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:23:41 --> $DIR/iterable.rs:23:41
| |
LL | fn iter<'a>(&'a self) -> Self::Iter<'a>; LL | fn iter<'a>(&'a self) -> Self::Iter<'a>;
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:32:41 --> $DIR/iterable.rs:32:41
| |
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/iterable.rs:43:41 --> $DIR/iterable.rs:43:41
| |
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -1,20 +1,26 @@
error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:26:27
|
LL | type FOk<T> = Self::E<'static, T>;
| ^^^^^^^ lifetime parameter not allowed
error[E0109]: type parameters are not allowed on this type error[E0109]: type parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:26:36 --> $DIR/parameter_number_and_kind.rs:26:36
| |
LL | type FOk<T> = Self::E<'static, T>; LL | type FOk<T> = Self::E<'static, T>;
| ^ type parameter not allowed | ^ type parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:26:27
|
LL | type FOk<T> = Self::E<'static, T>;
| ^^^^^^^ lifetime parameter not allowed on this type
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:29:26 --> $DIR/parameter_number_and_kind.rs:29:26
| |
LL | type FErr1 = Self::E<'static, 'static>; // Error LL | type FErr1 = Self::E<'static, 'static>; // Error
| ^^^^^^^ lifetime parameter not allowed on this type | ^^^^^^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:31:29
|
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
| ^^^^^^^ lifetime parameter not allowed
error[E0109]: type parameters are not allowed on this type error[E0109]: type parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:31:38 --> $DIR/parameter_number_and_kind.rs:31:38
@ -22,12 +28,6 @@ error[E0109]: type parameters are not allowed on this type
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
| ^ type parameter not allowed | ^ type parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:31:29
|
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
| ^^^^^^^ lifetime parameter not allowed on this type
error: aborting due to 5 previous errors error: aborting due to 5 previous errors
Some errors occurred: E0109, E0110. Some errors occurred: E0109, E0110.

View file

@ -10,7 +10,7 @@
#![feature(generic_associated_types)] #![feature(generic_associated_types)]
//FIXME(#44265): "lifetime parameter not allowed" errors will be addressed in a //FIXME(#44265): "lifetime parameter not allowed on this type" errors will be addressed in a
// follow-up PR // follow-up PR
use std::fmt::Display; use std::fmt::Display;

View file

@ -2,31 +2,31 @@ error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/streaming_iterator.rs:27:41 --> $DIR/streaming_iterator.rs:27:41
| |
LL | bar: <T as StreamingIterator>::Item<'static>, LL | bar: <T as StreamingIterator>::Item<'static>,
| ^^^^^^^ lifetime parameter not allowed on this type | ^^^^^^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/streaming_iterator.rs:35:64 --> $DIR/streaming_iterator.rs:35:64
| |
LL | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } LL | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/streaming_iterator.rs:21:48 --> $DIR/streaming_iterator.rs:21:48
| |
LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>>; LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>>;
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/streaming_iterator.rs:47:37 --> $DIR/streaming_iterator.rs:47:37
| |
LL | type Item<'a> = (usize, I::Item<'a>); LL | type Item<'a> = (usize, I::Item<'a>);
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type error[E0110]: lifetime parameters are not allowed on this type
--> $DIR/streaming_iterator.rs:49:48 --> $DIR/streaming_iterator.rs:49:48
| |
LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>> { LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>> {
| ^^ lifetime parameter not allowed on this type | ^^ lifetime parameter not allowed
error: aborting due to 5 previous errors error: aborting due to 5 previous errors