hir::PathSegment::new(
self.lower_ident(segment.ident),
generic_args,
- infer_types
+ infer_types,
)
}
) -> (hir::GenericArgs, bool) {
let &AngleBracketedArgs { ref args, ref bindings, .. } = data;
(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(),
parenthesized: false,
},
// FIXME: hack required because you can't create a static
// 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
{
let dummy = GenericArgs::none();
self.s.word(".")?;
self.print_name(segment.name)?;
- segment.with_args(|args| {
- if !args.args.is_empty() ||
- !args.bindings.is_empty()
+ segment.with_generic_args(|generic_args| {
+ if !generic_args.args.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 {
Ok(())
}
if segment.name != keywords::CrateRoot.name() &&
segment.name != keywords::DollarCrate.name() {
self.print_name(segment.name)?;
- segment.with_args(|parameters| {
- self.print_generic_args(parameters,
- segment.infer_types,
- colons_before_params)
+ segment.with_generic_args(|generic_args| {
+ self.print_generic_args(generic_args,
+ segment.infer_types,
+ colons_before_params)
})?;
}
}
if segment.name != keywords::CrateRoot.name() &&
segment.name != keywords::DollarCrate.name() {
self.print_name(segment.name)?;
- segment.with_args(|parameters| {
- self.print_generic_args(parameters,
- segment.infer_types,
- colons_before_params)
+ segment.with_generic_args(|generic_args| {
+ self.print_generic_args(generic_args,
+ segment.infer_types,
+ colons_before_params)
})?;
}
}
self.s.word("::")?;
let item_segment = path.segments.last().unwrap();
self.print_name(item_segment.name)?;
- item_segment.with_args(|parameters| {
- self.print_generic_args(parameters,
- item_segment.infer_types,
- colons_before_params)
+ item_segment.with_generic_args(|generic_args| {
+ self.print_generic_args(generic_args,
+ item_segment.infer_types,
+ colons_before_params)
})
}
hir::QPath::TypeRelative(ref qself, ref item_segment) => {
self.s.word(">")?;
self.s.word("::")?;
self.print_name(item_segment.name)?;
- item_segment.with_args(|parameters| {
- self.print_generic_args(parameters,
- item_segment.infer_types,
- colons_before_params)
+ item_segment.with_generic_args(|generic_args| {
+ self.print_generic_args(generic_args,
+ item_segment.infer_types,
+ colons_before_params)
})
}
}
let elide_lifetimes = generic_args.lifetimes().all(|lt| lt.is_elided());
if !elide_lifetimes {
start_or_comma(self)?;
- self.commasep(Inconsistent, &generic_args.args, |s, p| {
- match p {
+ self.commasep(Inconsistent, &generic_args.args, |s, generic_arg| {
+ match generic_arg {
GenericArg::Lifetime(lt) => s.print_lifetime(lt),
GenericArg::Type(ty) => s.print_type(ty),
- }
+ }
})?;
} else if generic_args.types().count() != 0 {
start_or_comma(self)?;
&mut self,
def: Def,
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;
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;
return;
}
- if args.lifetimes().all(|l| l.is_elided()) {
- self.resolve_elided_lifetimes(args.lifetimes().collect(), true);
+ if generic_args.lifetimes().all(|l| l.is_elided()) {
+ self.resolve_elided_lifetimes(generic_args.lifetimes().collect(), true);
} else {
- for l in args.lifetimes() {
+ for l in generic_args.lifetimes() {
self.visit_lifetime(l);
}
}
} else {
Some(Region::Static)
},
- Set1::One(r) => r.subst(args.lifetimes(), map),
+ Set1::One(r) => r.subst(generic_args.lifetimes(), map),
Set1::Many => None,
})
.collect()
});
- for (i, ty) in args.types().enumerate() {
+ for (i, ty) in generic_args.types().enumerate() {
if let Some(<) = object_lifetime_defaults.get(i) {
let scope = Scope::ObjectLifetimeDefault {
lifetime: lt,
}
}
- for b in &args.bindings {
+ for b in &generic_args.bindings {
self.visit_assoc_type_binding(b);
}
}
use hir::def_id::DefId;
use ty::{self, Ty, TypeFoldable, Substs, TyCtxt};
-use ty::subst::Kind;
use traits;
use rustc_target::spec::abi::Abi;
use util::ppaux;
}
}
-impl<'tcx> Into<Kind<'tcx>> for ty::Region<'tcx> {}
-
-impl<'tcx> Into<Kind<'tcx>> for Ty<'tcx> {}
-
impl<'tcx> Kind<'tcx> {
#[inline]
pub fn unpack(self) -> UnpackedKind<'tcx> {
use rustc::mir::mono::{Linkage, Visibility, Stats};
use rustc::middle::cstore::{EncodedMetadata};
use rustc::ty::{self, Ty, TyCtxt};
-use rustc::ty::subst::Kind;
use rustc::ty::layout::{self, Align, TyLayout, LayoutOf};
use rustc::ty::query::Providers;
use rustc::dep_graph::{DepNode, DepConstructor};
ast::TyKind::Paren(ref subty) => involves_impl_trait(subty),
ast::TyKind::Tup(ref tys) => any_involves_impl_trait(tys.iter()),
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,
Some(&ast::GenericArgs::AngleBracketed(ref data)) =>
any_involves_impl_trait(data.types().into_iter()) ||
use rustc::traits;
use rustc::ty::adjustment::CustomCoerceUnsized;
use rustc::ty::{self, Ty, TyCtxt};
-use rustc::ty::subst::Kind;
pub use rustc::ty::Instance;
pub use self::item::{MonoItem, MonoItemExt};
}
fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) {
match *generic_args {
- GenericArgs::AngleBracketed(ref params) => {
- for type_ in params.types() {
+ GenericArgs::AngleBracketed(ref generic_args) => {
+ for type_ in generic_args.types() {
self.visit_ty(type_);
}
- for type_binding in ¶ms.bindings {
+ for type_binding in &generic_args.bindings {
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
// are allowed to contain nested `impl Trait`.
self.with_impl_trait(None, |this| visit::walk_ty(this, &type_binding.ty));
}
}
- GenericArgs::Parenthesized(ref params) => {
- for type_ in ¶ms.inputs {
+ GenericArgs::Parenthesized(ref generic_args) => {
+ for type_ in &generic_args.inputs {
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,
// so it is also allowed to contain nested `impl Trait`.
self.with_impl_trait(None, |this| visit::walk_ty(this, type_));
// Type arguments
for seg in &path.segments {
- if let Some(ref args) = seg.args {
- match **args {
+ if let Some(ref generic_args) = seg.args {
+ match **generic_args {
ast::GenericArgs::AngleBracketed(ref data) => for t in data.types() {
self.visit_ty(t);
},
}
// Explicit types in the turbo-fish.
- if let Some(ref args) = seg.args {
- if let ast::GenericArgs::AngleBracketed(ref data) = **args {
+ if let Some(ref generic_args) = seg.args {
+ if let ast::GenericArgs::AngleBracketed(ref data) = **generic_args {
for t in data.types() {
self.visit_ty(t);
}
if path.segments.len() != 1 {
return false;
}
- if let Some(ref args) = path.segments[0].args {
- if let ast::GenericArgs::Parenthesized(_) = **args {
+ if let Some(ref generic_args) = path.segments[0].args {
+ if let ast::GenericArgs::Parenthesized(_) = **generic_args {
return true;
}
}
{
let (substs, assoc_bindings) =
- item_segment.with_args(|args| {
+ item_segment.with_generic_args(|generic_args| {
self.create_substs_for_ast_path(
span,
def_id,
- args,
+ generic_args,
item_segment.infer_types,
None)
});
fn create_substs_for_ast_path(&self,
span: Span,
def_id: DefId,
- args: &hir::GenericArgs,
+ generic_args: &hir::GenericArgs,
infer_types: bool,
self_ty: Option<Ty<'tcx>>)
-> (&'tcx Substs<'tcx>, Vec<ConvertedBinding<'tcx>>)
let tcx = self.tcx();
debug!("create_substs_for_ast_path(def_id={:?}, self_ty={:?}, \
- args={:?})",
- def_id, self_ty, args);
+ generic_args={:?})",
+ def_id, self_ty, generic_args);
// If the type is parameterized by this region, then replace this
// region with the current anon region binding (in other words,
// whatever & would get replaced with).
let decl_generics = tcx.generics_of(def_id);
- let ty_provided = args.types().count();
- let lt_provided = args.lifetimes().count();
+ let ty_provided = generic_args.types().count();
+ let lt_provided = generic_args.lifetimes().count();
let mut lt_accepted = 0;
let mut ty_params = ParamRange { required: 0, accepted: 0 };
match param.kind {
GenericParamDefKind::Lifetime => {
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()
} else {
tcx.types.re_static.into()
let i = i - (lt_accepted + own_self);
if i < ty_provided {
// 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 {
// No type parameters were provided, we can infer all.
if !default_needs_object_self(param) {
}
});
- let assoc_bindings = args.bindings.iter().map(|binding| {
+ let assoc_bindings = generic_args.bindings.iter().map(|binding| {
ConvertedBinding {
item_name: binding.name,
ty: self.ast_ty_to_ty(&binding.ty),
let trait_def = self.tcx().trait_def(trait_def_id);
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.
let msg = if trait_def.paren_sugar {
"the precise format of `Fn`-family traits' type parameters is subject to change. \
span, GateIssue::Language, msg);
}
- trait_segment.with_args(|parameters| {
+ trait_segment.with_generic_args(|generic_args| {
self.create_substs_for_ast_path(span,
trait_def_id,
- parameters,
+ generic_args,
trait_segment.infer_types,
Some(self_ty))
})
pub fn prohibit_type_params(&self, segments: &[hir::PathSegment]) {
for segment in segments {
- segment.with_args(|params| {
- for p in ¶ms.args {
- let (mut span_err, span, kind) = match p {
+ segment.with_generic_args(|generic_args| {
+ let mut err_for_lifetime = false;
+ let mut err_for_type = false;
+ for arg in &generic_args.args {
+ let (mut span_err, span, kind) = match arg {
hir::GenericArg::Lifetime(lt) => {
+ if err_for_lifetime { continue }
+ err_for_lifetime = true;
(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,
"lifetime")
}
hir::GenericArg::Type(ty) => {
+ if err_for_type { continue }
+ err_for_type = true;
(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,
"type")
}
};
span_err.span_label(span, format!("{} parameter not allowed", kind))
.emit();
- break;
+ if err_for_lifetime && err_for_type {
+ break;
+ }
}
- for binding in ¶ms.bindings {
+ for binding in &generic_args.bindings {
self.prohibit_projection(binding.span);
break;
}
match param.kind {
GenericParamDefKind::Lifetime => {
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) {
}
GenericParamDefKind::Type {..} => {
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.
/// Report errors if the provided parameters are too few or too many.
fn check_generic_arg_count(&self,
- span: Span,
- segment: &mut Option<(&hir::PathSegment, &ty::Generics)>,
- is_method_call: bool,
- supress_mismatch_error: bool) {
+ span: Span,
+ segment: &mut Option<(&hir::PathSegment, &ty::Generics)>,
+ is_method_call: bool,
+ supress_mismatch_error: bool) {
let (lifetimes, types, infer_types, bindings) = segment.map_or(
(vec![], vec![], true, &[][..]),
- |(s, _)| s.args.as_ref().map_or(
- (vec![], vec![], s.infer_types, &[][..]),
- |p| (p.lifetimes().collect(), p.types().collect(),
- s.infer_types, &p.bindings[..])));
+ |(s, _)| {
+ s.args.as_ref().map_or(
+ (vec![], vec![], s.infer_types, &[][..]),
+ |arg| {
+ (arg.lifetimes().collect(),
+ arg.types().collect(),
+ s.infer_types,
+ &arg.bindings[..])
+ }
+ )
+ });
let infer_lifetimes = lifetimes.len() == 0;
let count_lifetime_params = |n| {
let provided_params = &path.segments.last().unwrap();
let mut ty_substs = FxHashMap();
let mut lt_substs = FxHashMap();
- provided_params.with_args(|provided_params| {
+ provided_params.with_generic_args(|generic_args| {
let mut indices = GenericParamCount {
lifetimes: 0,
types: 0
for param in generics.params.iter() {
match param {
hir::GenericParam::Lifetime(lt_param) => {
- if let Some(lt) = provided_params.lifetimes()
+ if let Some(lt) = generic_args.lifetimes()
.nth(indices.lifetimes).cloned() {
if !lt.is_elided() {
let lt_def_id =
hir::GenericParam::Type(ty_param) => {
let ty_param_def =
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() {
ty_substs.insert(ty_param_def, ty.into_inner().clean(cx));
} else if let Some(default) = ty_param.default.clone() {
lifetimes: if self.lifetimes().all(|lt| lt.is_elided()) {
vec![]
} 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),
}
}
fn clean(&self, cx: &DocContext) -> PathSegment {
PathSegment {
name: self.name.clean(cx),
- args: self.with_args(|args| args.clean(cx))
+ args: self.with_generic_args(|generic_args| generic_args.clean(cx))
}
}
}
impl AngleBracketedArgs {
pub fn lifetimes(&self) -> impl DoubleEndedIterator<Item = &Lifetime> {
- self.args.iter().filter_map(|p| {
- if let GenericArg::Lifetime(lt) = p {
+ self.args.iter().filter_map(|arg| {
+ if let GenericArg::Lifetime(lt) = arg {
Some(lt)
} else {
None
}
pub fn types(&self) -> impl DoubleEndedIterator<Item = &P<Ty>> {
- self.args.iter().filter_map(|p| {
- if let GenericArg::Type(ty) = p {
+ self.args.iter().filter_map(|arg| {
+ if let GenericArg::Type(ty) = arg {
Some(ty)
} else {
None
fn path_all(&self, sp: Span,
global: bool,
idents: Vec<ast::Ident>,
- parameters: Vec<ast::GenericArg>,
+ args: Vec<ast::GenericArg>,
bindings: Vec<ast::TypeBinding>)
-> ast::Path;
fn qpath_all(&self, self_type: P<ast::Ty>,
trait_path: ast::Path,
ident: ast::Ident,
- parameters: Vec<ast::GenericArg>,
+ args: Vec<ast::GenericArg>,
bindings: Vec<ast::TypeBinding>)
-> (ast::QSelf, ast::Path);
impl<'a> AstBuilder for ExtCtxt<'a> {
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 {
self.path(span, vec![id])
}
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,
span: Span,
bindings: Vec<ast::TypeBinding> )
-> ast::Path {
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| {
ast::PathSegment::from_ident(ident.with_span_pos(span))
self.path_all(DUMMY_SP,
true,
self.std_path(&["option", "Option"]),
- vec![ ast::GenericArg::Type(ty) ],
+ vec![ast::GenericArg::Type(ty)],
Vec::new()))
}
noop_fold_exprs(es, self)
}
- fn fold_param(&mut self, p: GenericArg) -> GenericArg {
- match p {
- GenericArg::Lifetime(lt) =>
- GenericArg::Lifetime(self.fold_lifetime(lt)),
+ fn fold_generic_arg(&mut self, arg: GenericArg) -> GenericArg {
+ match arg {
+ GenericArg::Lifetime(lt) => GenericArg::Lifetime(self.fold_lifetime(lt)),
GenericArg::Type(ty) => GenericArg::Type(self.fold_ty(ty)),
}
}
pub fn noop_fold_path<T: Folder>(Path { segments, span }: Path, fld: &mut T) -> Path {
Path {
- segments: segments.move_map(|PathSegment {ident, args}| PathSegment {
+ segments: segments.move_map(|PathSegment { ident, args }| PathSegment {
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)
}
(qself, fld.fold_path(path))
}
-pub fn noop_fold_generic_args<T: Folder>(generic_args: GenericArgs, fld: &mut T)
- -> GenericArgs
+pub fn noop_fold_generic_args<T: Folder>(generic_args: GenericArgs, fld: &mut T) -> GenericArgs
{
match generic_args {
- GenericArgs::AngleBracketed(data) =>
- GenericArgs::AngleBracketed(fld.fold_angle_bracketed_parameter_data(data)),
- GenericArgs::Parenthesized(data) =>
- GenericArgs::Parenthesized(fld.fold_parenthesized_parameter_data(data)),
+ GenericArgs::AngleBracketed(data) => {
+ GenericArgs::AngleBracketed(fld.fold_angle_bracketed_parameter_data(data))
+ }
+ GenericArgs::Parenthesized(data) => {
+ GenericArgs::Parenthesized(fld.fold_parenthesized_parameter_data(data))
+ }
}
}
-> AngleBracketedArgs
{
let AngleBracketedArgs { args, bindings, span } = data;
- AngleBracketedArgs { args: args.move_map(|p| fld.fold_param(p)),
- bindings: bindings.move_map(|b| fld.fold_ty_binding(b)),
- span: fld.new_span(span) }
+ AngleBracketedArgs {
+ args: args.move_map(|arg| fld.fold_generic_arg(arg)),
+ 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,
-> ParenthesizedArgData
{
let ParenthesizedArgData { inputs, output, span } = data;
- ParenthesizedArgData { inputs: inputs.move_map(|ty| fld.fold_ty(ty)),
- output: output.map(|ty| fld.fold_ty(ty)),
- span: fld.new_span(span) }
+ ParenthesizedArgData {
+ inputs: inputs.move_map(|ty| fld.fold_ty(ty)),
+ 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> {
ExprKind::MethodCall(
PathSegment {
ident: folder.fold_ident(seg.ident),
- args: seg.args.map(|ps| {
- ps.map(|ps| folder.fold_generic_args(ps))
+ args: seg.args.map(|args| {
+ args.map(|args| folder.fold_generic_args(args))
}),
},
folder.fold_exprs(args))
Ok(())
}
- pub fn print_param(&mut self, param: &GenericArg) -> io::Result<()> {
- match param {
+ pub fn print_generic_arg(&mut self, generic_arg: &GenericArg) -> io::Result<()> {
+ match generic_arg {
GenericArg::Lifetime(lt) => self.print_lifetime(lt),
GenericArg::Type(ty) => self.print_type(ty),
}
}
fn print_generic_args(&mut self,
- args: &ast::GenericArgs,
- colons_before_params: bool)
- -> io::Result<()>
+ args: &ast::GenericArgs,
+ colons_before_params: bool)
+ -> io::Result<()>
{
if colons_before_params {
self.s.word("::")?
ast::GenericArgs::AngleBracketed(ref data) => {
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;
fn visit_generic_args(&mut self, path_span: Span, generic_args: &'ast GenericArgs) {
walk_generic_args(self, path_span, generic_args)
}
- fn visit_angle_bracketed_param(&mut self, param: &'ast GenericArg) {
- match param {
+ fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg) {
+ match generic_arg {
GenericArg::Lifetime(lt) => self.visit_lifetime(lt),
GenericArg::Type(ty) => self.visit_ty(ty),
}
{
match *generic_args {
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);
}
GenericArgs::Parenthesized(ref data) => {
--> $DIR/E0110.rs:11:14
|
LL | type X = u32<'static>; //~ ERROR E0110
- | ^^^^^^^ lifetime parameter not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
error: aborting due to previous error
--> $DIR/collections.rs:33:50
|
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
--> $DIR/collections.rs:59:50
|
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
--> $DIR/construct_with_other_type.rs:26:46
|
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
--> $DIR/construct_with_other_type.rs:26:63
|
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
--> $DIR/construct_with_other_type.rs:34:40
|
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
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:20:47
|
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
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:22:37
|
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
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:26:41
|
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
--> $DIR/iterable.rs:20:47
|
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
--> $DIR/iterable.rs:49:53
|
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
--> $DIR/iterable.rs:54:60
|
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
--> $DIR/iterable.rs:23:41
|
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
--> $DIR/iterable.rs:32:41
|
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
--> $DIR/iterable.rs:43:41
|
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[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
--> $DIR/parameter_number_and_kind.rs:26:36
|
| ^ type parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/parameter_number_and_kind.rs:26:27
+ --> $DIR/parameter_number_and_kind.rs:29:26
|
-LL | type FOk<T> = Self::E<'static, T>;
- | ^^^^^^^ lifetime parameter not allowed on this type
+LL | type FErr1 = Self::E<'static, 'static>; // Error
+ | ^^^^^^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/parameter_number_and_kind.rs:29:26
+ --> $DIR/parameter_number_and_kind.rs:31:29
|
-LL | type FErr1 = Self::E<'static, 'static>; // Error
- | ^^^^^^^ lifetime parameter not allowed on this type
+LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
+ | ^^^^^^^ lifetime parameter not allowed
error[E0109]: type parameters are not allowed on this type
--> $DIR/parameter_number_and_kind.rs:31:38
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
| ^ 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
Some errors occurred: E0109, E0110.
#![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
use std::fmt::Display;
--> $DIR/streaming_iterator.rs:27:41
|
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
--> $DIR/streaming_iterator.rs:35:64
|
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
--> $DIR/streaming_iterator.rs:21:48
|
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
--> $DIR/streaming_iterator.rs:47:37
|
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
--> $DIR/streaming_iterator.rs:49:48
|
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