]> git.lizzy.rs Git - rust.git/commitdiff
Make method and variable names more consistent
authorvarkor <github@varkor.com>
Wed, 16 May 2018 11:57:45 +0000 (12:57 +0100)
committervarkor <github@varkor.com>
Wed, 20 Jun 2018 11:19:04 +0000 (12:19 +0100)
28 files changed:
src/librustc/hir/lowering.rs
src/librustc/hir/mod.rs
src/librustc/hir/print.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/ty/instance.rs
src/librustc/ty/subst.rs
src/librustc_codegen_llvm/base.rs
src/librustc_driver/pretty.rs
src/librustc_mir/monomorphize/mod.rs
src/librustc_passes/ast_validation.rs
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/lib.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/mod.rs
src/librustdoc/clean/mod.rs
src/libsyntax/ast.rs
src/libsyntax/ext/build.rs
src/libsyntax/fold.rs
src/libsyntax/print/pprust.rs
src/libsyntax/visit.rs
src/test/ui/error-codes/E0110.stderr
src/test/ui/rfc1598-generic-associated-types/collections.stderr
src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr
src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
src/test/ui/rfc1598-generic-associated-types/iterable.stderr
src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr
src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs
src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr

index 831a689a349979b123f2a8fc7008e5a223007114..d00792be4eb56696e12bf909b376d3e20573c61f 100644 (file)
@@ -1726,7 +1726,7 @@ fn lower_path_segment(
         hir::PathSegment::new(
             self.lower_ident(segment.ident),
             generic_args,
-            infer_types
+            infer_types,
         )
     }
 
@@ -1738,7 +1738,7 @@ fn lower_angle_bracketed_parameter_data(
     ) -> (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,
         },
index 729ac17ae099131a7c91c55f15e29064e670f029..d4785e40b1f8a712e7bef3b26000b437a344c163 100644 (file)
@@ -360,7 +360,7 @@ pub fn new(name: Name, args: GenericArgs, infer_types: bool) -> Self {
 
     // 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();
index c12d258b6c7c99841c41871d2cc007b79509267d..5420be64ca43ae61190ef14b674f3ab97fde8506 100644 (file)
@@ -1269,11 +1269,11 @@ fn print_expr_method_call(&mut self,
         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(())
             }
@@ -1641,10 +1641,10 @@ pub fn print_path(&mut self,
             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)
                })?;
             }
         }
@@ -1673,10 +1673,10 @@ pub fn print_qpath(&mut self,
                     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)
                         })?;
                     }
                 }
@@ -1685,10 +1685,10 @@ pub fn print_qpath(&mut self,
                 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) => {
@@ -1697,10 +1697,10 @@ pub fn print_qpath(&mut self,
                 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)
                 })
             }
         }
@@ -1734,11 +1734,11 @@ fn print_generic_args(&mut self,
             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)?;
index 39dfa77ea677ee75f0b5289066fff1bb670410a2..8f1cd9bb30ecdde1d5f37de9412ffc1051a68929 100644 (file)
@@ -1601,20 +1601,21 @@ fn visit_segment_args(
         &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);
             }
         }
@@ -1686,13 +1687,13 @@ fn visit_segment_args(
                     } 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(&lt) = object_lifetime_defaults.get(i) {
                 let scope = Scope::ObjectLifetimeDefault {
                     lifetime: lt,
@@ -1704,7 +1705,7 @@ fn visit_segment_args(
             }
         }
 
-        for b in &args.bindings {
+        for b in &generic_args.bindings {
             self.visit_assoc_type_binding(b);
         }
     }
index 8b1c31deb1377d20431a5c762d5e41776b461c4c..66edbeff749f712f8762bf84f0035bf4c3452a5a 100644 (file)
@@ -10,7 +10,6 @@
 
 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;
index 932f082c87cb0824b6cc217b7481949d337bae56..2e3c6df9754dfeb82fee896d283e266611ec43d1 100644 (file)
@@ -105,10 +105,6 @@ fn from(ty: Ty<'tcx>) -> Kind<'tcx> {
     }
 }
 
-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> {
index 7c8ba63c15eb9812d0e125cfdb1bd18aceb87bc8..322924535d1f72baeb5588eecad1f606043e09e3 100644 (file)
@@ -40,7 +40,6 @@
 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};
index 7468f01de705fd659875f16741f0262ddf609428..0ea2832bf80d9ad181d035a4e56e09d48bd66798 100644 (file)
@@ -677,7 +677,7 @@ fn involves_impl_trait(ty: &ast::Ty) -> bool {
                     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()) ||
index 3afe9991c68d076d545d002375b201b52d183d17..bf544e5120cd81d691e6741c6da186ee4c4db7f8 100644 (file)
@@ -13,7 +13,6 @@
 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};
index 63c8bd3d1f77a2945a028340ff90cff318ac4275..211a45bc3c5d6e077dc4697ca6fce19eca705313 100644 (file)
@@ -523,21 +523,21 @@ fn visit_ty(&mut self, t: &'a Ty) {
     }
     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 &params.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 &params.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_));
index fa055d246f30ac903efd56ab4da5731bf2131ba9..055d58f0b1f5f8f5df2e476162d15936328c76d7 100644 (file)
@@ -820,8 +820,8 @@ fn process_path(&mut self, id: NodeId, path: &'l ast::Path) {
 
         // 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);
                     },
@@ -905,8 +905,8 @@ fn process_method_call(
         }
 
         // 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);
                 }
index 4f03698d9b17c64cacac0ca4151f530ff56f17d7..8a44f271055e2844ea142db35ca933e98bb4b290 100644 (file)
@@ -692,8 +692,8 @@ fn fn_type(path: &ast::Path) -> bool {
             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;
                 }
             }
index be4c423e959bbc7c9aa4ddb032acbe72afe763fe..e4b3b4e60413d2e2a1fe48673d1d66b38114c49c 100644 (file)
@@ -177,11 +177,11 @@ pub fn ast_path_substs_for_ty(&self,
     {
 
         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)
             });
@@ -199,7 +199,7 @@ pub fn ast_path_substs_for_ty(&self,
     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>>)
@@ -207,15 +207,15 @@ fn create_substs_for_ast_path(&self,
         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 };
@@ -269,7 +269,7 @@ fn create_substs_for_ast_path(&self,
             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()
@@ -286,7 +286,7 @@ fn create_substs_for_ast_path(&self,
                     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) {
@@ -330,7 +330,7 @@ fn create_substs_for_ast_path(&self,
             }
         });
 
-        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),
@@ -451,7 +451,8 @@ fn create_substs_for_ast_trait_ref(&self,
         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. \
@@ -463,10 +464,10 @@ fn create_substs_for_ast_trait_ref(&self,
                              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))
         })
@@ -970,27 +971,36 @@ fn qpath_to_ty(&self,
 
     pub fn prohibit_type_params(&self, segments: &[hir::PathSegment]) {
         for segment in segments {
-            segment.with_args(|params| {
-                for p in &params.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 &params.bindings {
+                for binding in &generic_args.bindings {
                     self.prohibit_projection(binding.span);
                     break;
                 }
index 5af3d2fc42c9ec96e2a93c968ba61fa70f512381..c0779235e8939443edb39bc974588fc947b304ed 100644 (file)
@@ -4834,7 +4834,7 @@ pub fn instantiate_value_path(&self,
             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) {
@@ -4845,7 +4845,9 @@ pub fn instantiate_value_path(&self,
                 }
                 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.
@@ -4956,16 +4958,23 @@ fn check_rustc_args_require_const(&self,
 
     /// 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| {
index 793a8a7f110356aac61c1f34bcfb4d2cf7393bc0..0d44c583cffd4283c514a5f8bbb82bc22633ab9d 100644 (file)
@@ -2851,7 +2851,7 @@ fn clean(&self, cx: &DocContext) -> Type {
                     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
@@ -2859,7 +2859,7 @@ fn clean(&self, cx: &DocContext) -> Type {
                         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 =
@@ -2872,7 +2872,7 @@ fn clean(&self, cx: &DocContext) -> Type {
                                 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() {
@@ -3497,9 +3497,9 @@ fn clean(&self, cx: &DocContext) -> GenericArgs {
                 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),
             }
         }
@@ -3516,7 +3516,7 @@ impl Clean<PathSegment> for hir::PathSegment {
     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))
         }
     }
 }
index 7ff00123624f6e979c17c5dba571a69c4a98e657..5ae520050e59331505f4a78add416be4e57def84 100644 (file)
@@ -188,8 +188,8 @@ pub struct AngleBracketedArgs {
 
 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
@@ -198,8 +198,8 @@ pub fn lifetimes(&self) -> impl DoubleEndedIterator<Item = &Lifetime> {
     }
 
     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
index 05a345fb2a1759c119e46c8e8b4de0398b3b4ba4..c544adb5c1c868e229514e4edf4e5c6c8db40fe4 100644 (file)
@@ -31,7 +31,7 @@ pub trait AstBuilder {
     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;
 
@@ -42,7 +42,7 @@ fn qpath(&self, self_type: P<ast::Ty>,
     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);
 
@@ -302,13 +302,13 @@ fn item_use_glob(&self, sp: Span,
 
 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,
@@ -318,7 +318,7 @@ fn path_all(&self,
                 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))
@@ -424,7 +424,7 @@ fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty> {
             self.path_all(DUMMY_SP,
                           true,
                           self.std_path(&["option", "Option"]),
-                          vec![ ast::GenericArg::Type(ty) ],
+                          vec![ast::GenericArg::Type(ty)],
                           Vec::new()))
     }
 
index dc23ed19d1bee52fcbd95d16dbe94965d7c67603..f74fe1feb40c127638be7d0399acd3e933bc0c48 100644 (file)
@@ -132,10 +132,9 @@ fn fold_exprs(&mut self, es: Vec<P<Expr>>) -> Vec<P<Expr>> {
         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)),
         }
     }
@@ -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 {
     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)
     }
@@ -462,14 +461,15 @@ pub fn noop_fold_qpath<T: Folder>(qself: Option<QSelf>,
     (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))
+        }
     }
 }
 
@@ -478,9 +478,11 @@ pub fn noop_fold_angle_bracketed_parameter_data<T: Folder>(data: AngleBracketedA
                                                            -> 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,
@@ -488,9 +490,11 @@ pub fn noop_fold_parenthesized_parameter_data<T: Folder>(data: ParenthesizedArgD
                                                          -> 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> {
@@ -1191,8 +1195,8 @@ pub fn noop_fold_expr<T: Folder>(Expr {id, node, span, attrs}: Expr, folder: &mu
                 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))
index 3b487430c52a54aae84ad9844d24d1808ff0d488..3e0e533bc08a8765ad30160123415df43345f668 100644 (file)
@@ -1017,8 +1017,8 @@ pub fn print_opt_lifetime(&mut self,
         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),
         }
@@ -2469,9 +2469,9 @@ fn print_qpath(&mut self,
     }
 
     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("::")?
@@ -2481,7 +2481,9 @@ fn print_generic_args(&mut self,
             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;
 
index 906f1941cd6a740b567a77288e8a87d76e86330f..5ac33701baf29df4ecce9b1bf61b99fa710f8c13 100644 (file)
@@ -131,8 +131,8 @@ fn visit_path_segment(&mut self, path_span: Span, path_segment: &'ast PathSegmen
     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),
         }
@@ -393,7 +393,7 @@ pub fn walk_generic_args<'a, V>(visitor: &mut V,
 {
     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) => {
index 10e06ee6d025a4f5169d6b3e9b0b5342ba7ed25e..7f5b78684fbc18a9011b7cd6585532a47594279b 100644 (file)
@@ -2,7 +2,7 @@ error[E0110]: lifetime parameters are not allowed on this type
   --> $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
 
index ed96570583f4ffb4bbda6230eaa2a5438f686b9d..8c31ab2ca88e4d71a88dda2c6d1b759b1c3444d0 100644 (file)
@@ -20,13 +20,13 @@ error[E0110]: lifetime parameters are not allowed on this type
   --> $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
 
index 764a0db2478a8478d7d86dd03758905bf9db48f4..1746122eb49f41d68b726acf25b086e6cda7e555 100644 (file)
@@ -2,19 +2,19 @@ error[E0110]: lifetime parameters are not allowed on this type
   --> $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
 
index 64e82c0d1097ffc1de33bf470488046bb9d4f9a5..d48c21477b310668bfa620ace9f6314c561a08e0 100644 (file)
@@ -14,19 +14,19 @@ error[E0110]: lifetime parameters are not allowed on this type
   --> $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
 
index 0e251300e451f8bb49eae67a15577a72ead73977..737a29ec2c8be46ced3f82ad9674b416b6ca9b73 100644 (file)
@@ -2,37 +2,37 @@ error[E0110]: lifetime parameters are not allowed on this type
   --> $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
 
index df83fdaad5bfa66f13ce9210569fe1a31e288faf..c8d37a51fa96bd5cd73e1c6161a89c453bca1b62 100644 (file)
@@ -1,3 +1,9 @@
+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
    |
@@ -5,16 +11,16 @@ LL |     type FOk<T> = Self::E<'static, T>;
    |                                    ^ 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
@@ -22,12 +28,6 @@ error[E0109]: type parameters are not allowed on this type
 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.
index 3f69de3de834f8d3ca61be8d84c9b5c92401c563..522ddb5dc135e36e162d34cc5bfb34e2f27f427b 100644 (file)
@@ -10,7 +10,7 @@
 
 #![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;
index 607a4b8d57996e1cb0343783c379a9e4669093c8..12e206cbd476af56a70098be716d39a69b699fc8 100644 (file)
@@ -2,31 +2,31 @@ error[E0110]: lifetime parameters are not allowed on this type
   --> $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