]> git.lizzy.rs Git - rust.git/commitdiff
Rename AssocKind::Method to AssocKind::Fn
authorRustin-Liu <rustin.liu@gmail.com>
Wed, 1 Apr 2020 02:09:50 +0000 (10:09 +0800)
committerRustin-Liu <rustin.liu@gmail.com>
Mon, 13 Apr 2020 23:12:07 +0000 (07:12 +0800)
Rename fn_has_self_argument to fn_has_self_parameter

Rename AssocItemKind::Method to AssocItemKind::Fn

Refine has_no_input_arg

Refine has_no_input_arg

Revert has_no_input_arg

Refine suggestion_descr

Move as_def_kind into AssocKind

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
Fix tidy check issue

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
44 files changed:
src/librustc_ast_lowering/item.rs
src/librustc_hir/hir.rs
src/librustc_infer/infer/error_reporting/nice_region_error/util.rs
src/librustc_metadata/rmeta/decoder.rs
src/librustc_metadata/rmeta/encoder.rs
src/librustc_middle/traits/specialization_graph.rs
src/librustc_middle/ty/adjustment.rs
src/librustc_middle/ty/instance.rs
src/librustc_middle/ty/mod.rs
src/librustc_mir/shim.rs
src/librustc_mir_build/hair/cx/mod.rs
src/librustc_privacy/lib.rs
src/librustc_resolve/build_reduced_graph.rs
src/librustc_resolve/late/lifetimes.rs
src/librustc_trait_selection/traits/error_reporting/suggestions.rs
src/librustc_trait_selection/traits/mod.rs
src/librustc_trait_selection/traits/object_safety.rs
src/librustc_trait_selection/traits/util.rs
src/librustc_ty/ty.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/impl_wf_check.rs
src/librustdoc/clean/mod.rs
src/librustdoc/passes/collect_intra_doc_links.rs
src/test/ui/error-codes/E0034.stderr
src/test/ui/inference/inference_unstable_featured.stderr
src/test/ui/issues/issue-18446.stderr
src/test/ui/issues/issue-3702-2.stderr
src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr
src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr
src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr
src/test/ui/methods/method-ambig-two-traits-from-impls.stderr
src/test/ui/methods/method-ambig-two-traits-from-impls2.stderr
src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr
src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr
src/test/ui/span/issue-37767.stderr
src/test/ui/span/issue-7575.stderr
src/test/ui/traits/trait-alias-ambiguous.stderr

index 9779954d75944a9ecfb2fd2c53ea90bfb50f38d0..c535885e70cb3956ad9bf716dd2059f88297ed6a 100644 (file)
@@ -796,7 +796,7 @@ fn lower_trait_item_ref(&mut self, i: &AssocItem) -> hir::TraitItemRef {
                 (hir::AssocItemKind::Type, default.is_some())
             }
             AssocItemKind::Fn(_, sig, _, default) => {
-                (hir::AssocItemKind::Method { has_self: sig.decl.has_self() }, default.is_some())
+                (hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }, default.is_some())
             }
             AssocItemKind::MacCall(..) => unimplemented!(),
         };
@@ -894,7 +894,7 @@ fn lower_impl_item_ref(&mut self, i: &AssocItem) -> hir::ImplItemRef<'hir> {
                     }
                 }
                 AssocItemKind::Fn(_, sig, ..) => {
-                    hir::AssocItemKind::Method { has_self: sig.decl.has_self() }
+                    hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
                 }
                 AssocItemKind::MacCall(..) => unimplemented!(),
             },
index b719d576d6f67b632da1992055960183d1aa2883..172d1e263ea10d2c2959c980a7c2302f416373cf 100644 (file)
@@ -2515,7 +2515,7 @@ pub struct ImplItemRef<'hir> {
 #[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable_Generic)]
 pub enum AssocItemKind {
     Const,
-    Method { has_self: bool },
+    Fn { has_self: bool },
     Type,
     OpaqueTy,
 }
index d35a589320badcbe8136922fa909fbe50ddffc1b..7bbd2127bcfdfe5812fb923d72e29c18457711d5 100644 (file)
@@ -118,7 +118,7 @@ pub(super) fn is_return_type_anon(
     // enable E0621 for it.
     pub(super) fn is_self_anon(&self, is_first: bool, scope_def_id: DefId) -> bool {
         is_first
-            && self.tcx().opt_associated_item(scope_def_id).map(|i| i.method_has_self_argument)
+            && self.tcx().opt_associated_item(scope_def_id).map(|i| i.fn_has_self_parameter)
                 == Some(true)
     }
 }
index 078f9251adfab9deb29cf328fb6f9b6818a3e154..ef6f37c5dab2dddaca23512fecc6821be13b9560 100644 (file)
@@ -1153,7 +1153,7 @@ fn get_associated_item(&self, id: DefIndex, sess: &Session) -> ty::AssocItem {
             EntryKind::AssocConst(container, _, _) => (ty::AssocKind::Const, container, false),
             EntryKind::AssocFn(data) => {
                 let data = data.decode(self);
-                (ty::AssocKind::Method, data.container, data.has_self)
+                (ty::AssocKind::Fn, data.container, data.has_self)
             }
             EntryKind::AssocType(container) => (ty::AssocKind::Type, container, false),
             EntryKind::AssocOpaqueTy(container) => (ty::AssocKind::OpaqueTy, container, false),
@@ -1167,7 +1167,7 @@ fn get_associated_item(&self, id: DefIndex, sess: &Session) -> ty::AssocItem {
             defaultness: container.defaultness(),
             def_id: self.local_def_id(id),
             container: container.with_def_id(parent),
-            method_has_self_argument: has_self,
+            fn_has_self_parameter: has_self,
         }
     }
 
index d75298fae0032eb7bfd3a665aaf8e5d842c3866f..9c9869c85571fb9eb355533debab7ace1ee73cc7 100644 (file)
@@ -839,7 +839,7 @@ fn encode_info_for_trait_item(&mut self, def_id: DefId) {
                     rendered_const,
                 )
             }
-            ty::AssocKind::Method => {
+            ty::AssocKind::Fn => {
                 let fn_data = if let hir::TraitItemKind::Fn(m_sig, m) = &ast_item.kind {
                     let param_names = match *m {
                         hir::TraitFn::Required(ref names) => {
@@ -860,7 +860,7 @@ fn encode_info_for_trait_item(&mut self, def_id: DefId) {
                 EntryKind::AssocFn(self.lazy(AssocFnData {
                     fn_data,
                     container,
-                    has_self: trait_item.method_has_self_argument,
+                    has_self: trait_item.fn_has_self_parameter,
                 }))
             }
             ty::AssocKind::Type => EntryKind::AssocType(container),
@@ -874,7 +874,7 @@ fn encode_info_for_trait_item(&mut self, def_id: DefId) {
         self.encode_const_stability(def_id);
         self.encode_deprecation(def_id);
         match trait_item.kind {
-            ty::AssocKind::Const | ty::AssocKind::Method => {
+            ty::AssocKind::Const | ty::AssocKind::Fn => {
                 self.encode_item_type(def_id);
             }
             ty::AssocKind::Type => {
@@ -884,7 +884,7 @@ fn encode_info_for_trait_item(&mut self, def_id: DefId) {
             }
             ty::AssocKind::OpaqueTy => unreachable!(),
         }
-        if trait_item.kind == ty::AssocKind::Method {
+        if trait_item.kind == ty::AssocKind::Fn {
             record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
             self.encode_variances_of(def_id);
         }
@@ -931,7 +931,7 @@ fn encode_info_for_impl_item(&mut self, def_id: DefId) {
                     bug!()
                 }
             }
-            ty::AssocKind::Method => {
+            ty::AssocKind::Fn => {
                 let fn_data = if let hir::ImplItemKind::Fn(ref sig, body) = ast_item.kind {
                     FnData {
                         asyncness: sig.header.asyncness,
@@ -944,7 +944,7 @@ fn encode_info_for_impl_item(&mut self, def_id: DefId) {
                 EntryKind::AssocFn(self.lazy(AssocFnData {
                     fn_data,
                     container,
-                    has_self: impl_item.method_has_self_argument,
+                    has_self: impl_item.fn_has_self_parameter,
                 }))
             }
             ty::AssocKind::OpaqueTy => EntryKind::AssocOpaqueTy(container),
@@ -958,7 +958,7 @@ fn encode_info_for_impl_item(&mut self, def_id: DefId) {
         self.encode_const_stability(def_id);
         self.encode_deprecation(def_id);
         self.encode_item_type(def_id);
-        if impl_item.kind == ty::AssocKind::Method {
+        if impl_item.kind == ty::AssocKind::Fn {
             record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
             self.encode_variances_of(def_id);
         }
index a2793f98050048ceeed91f55138599f5ebe0982e..bc743666e4a2194f64e1d2dea37118010cc4e92b 100644 (file)
@@ -107,13 +107,13 @@ pub fn item(
             .find(move |impl_item| {
                 match (trait_item_kind, impl_item.kind) {
                 | (Const, Const)
-                | (Method, Method)
+                | (Fn, Fn)
                 | (Type, Type)
                 | (Type, OpaqueTy)  // assoc. types can be made opaque in impls
                 => tcx.hygienic_eq(impl_item.ident, trait_item_name, trait_def_id),
 
                 | (Const, _)
-                | (Method, _)
+                | (Fn, _)
                 | (Type, _)
                 | (OpaqueTy, _)
                 => false,
index 851bffc2065c972d89c26a14242faa1a608eb7be..efd5adeba8c5af244edb3d5fac8dd163c628cc33 100644 (file)
@@ -123,7 +123,7 @@ pub fn method_call(&self, tcx: TyCtxt<'tcx>, source: Ty<'tcx>) -> (DefId, Substs
         let method_def_id = tcx
             .associated_items(trait_def_id.unwrap())
             .in_definition_order()
-            .find(|m| m.kind == ty::AssocKind::Method)
+            .find(|m| m.kind == ty::AssocKind::Fn)
             .unwrap()
             .def_id;
         (method_def_id, tcx.mk_substs_trait(source, &[]))
index 894f9070ce1549ec4bd2f8bf9017b5b59799a96d..ca76cfb14921e25414d088f6c0c6b3a526e8687a 100644 (file)
@@ -366,7 +366,7 @@ pub fn fn_once_adapter_instance(
         let call_once = tcx
             .associated_items(fn_once)
             .in_definition_order()
-            .find(|it| it.kind == ty::AssocKind::Method)
+            .find(|it| it.kind == ty::AssocKind::Fn)
             .unwrap()
             .def_id;
         let def = ty::InstanceDef::ClosureOnceShim { call_once };
index 0e6c4f26222ff6b0ac88b0419c4d5cdd77ae710c..8d50f560a83706c9fde767c0d7bf21e62d6a7b58 100644 (file)
@@ -1,5 +1,3 @@
-// ignore-tidy-filelength
-
 pub use self::fold::{TypeFoldable, TypeVisitor};
 pub use self::AssocItemContainer::*;
 pub use self::BorrowKind::*;
@@ -192,58 +190,50 @@ pub struct AssocItem {
     pub container: AssocItemContainer,
 
     /// Whether this is a method with an explicit self
-    /// as its first argument, allowing method calls.
-    pub method_has_self_argument: bool,
+    /// as its first parameter, allowing method calls.
+    pub fn_has_self_parameter: bool,
 }
 
 #[derive(Copy, Clone, PartialEq, Debug, HashStable)]
 pub enum AssocKind {
     Const,
-    Method,
+    Fn,
     OpaqueTy,
     Type,
 }
 
 impl AssocKind {
-    pub fn suggestion_descr(&self) -> &'static str {
-        match self {
-            ty::AssocKind::Method => "method call",
-            ty::AssocKind::Type | ty::AssocKind::OpaqueTy => "associated type",
-            ty::AssocKind::Const => "associated constant",
-        }
-    }
-
     pub fn namespace(&self) -> Namespace {
         match *self {
             ty::AssocKind::OpaqueTy | ty::AssocKind::Type => Namespace::TypeNS,
-            ty::AssocKind::Const | ty::AssocKind::Method => Namespace::ValueNS,
+            ty::AssocKind::Const | ty::AssocKind::Fn => Namespace::ValueNS,
         }
     }
-}
 
-impl AssocItem {
-    pub fn def_kind(&self) -> DefKind {
-        match self.kind {
+    pub fn as_def_kind(&self) -> DefKind {
+        match self {
             AssocKind::Const => DefKind::AssocConst,
-            AssocKind::Method => DefKind::AssocFn,
+            AssocKind::Fn => DefKind::AssocFn,
             AssocKind::Type => DefKind::AssocTy,
             AssocKind::OpaqueTy => DefKind::AssocOpaqueTy,
         }
     }
+}
 
+impl AssocItem {
     /// Tests whether the associated item admits a non-trivial implementation
     /// for !
     pub fn relevant_for_never(&self) -> bool {
         match self.kind {
             AssocKind::OpaqueTy | AssocKind::Const | AssocKind::Type => true,
             // FIXME(canndrew): Be more thorough here, check if any argument is uninhabited.
-            AssocKind::Method => !self.method_has_self_argument,
+            AssocKind::Fn => !self.fn_has_self_parameter,
         }
     }
 
     pub fn signature(&self, tcx: TyCtxt<'_>) -> String {
         match self.kind {
-            ty::AssocKind::Method => {
+            ty::AssocKind::Fn => {
                 // We skip the binder here because the binder would deanonymize all
                 // late-bound regions, and we don't want method signatures to show up
                 // `as for<'r> fn(&'r MyType)`.  Pretty-printing handles late-bound
@@ -2664,7 +2654,7 @@ pub fn par_body_owners<F: Fn(LocalDefId) + sync::Sync + sync::Send>(self, f: F)
     pub fn provided_trait_methods(self, id: DefId) -> impl 'tcx + Iterator<Item = &'tcx AssocItem> {
         self.associated_items(id)
             .in_definition_order()
-            .filter(|item| item.kind == AssocKind::Method && item.defaultness.has_value())
+            .filter(|item| item.kind == AssocKind::Fn && item.defaultness.has_value())
     }
 
     pub fn trait_relevant_for_never(self, did: DefId) -> bool {
index 67de81ed77baaa5f58269fcecf526e214a2c1716..e1473cbfb6328500c4dfe8a1fba85c5eb1e1af43 100644 (file)
@@ -74,7 +74,7 @@ fn make_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx
             let call_mut = tcx
                 .associated_items(fn_mut)
                 .in_definition_order()
-                .find(|it| it.kind == ty::AssocKind::Method)
+                .find(|it| it.kind == ty::AssocKind::Fn)
                 .unwrap()
                 .def_id;
 
index 503bd26d51fcc9287c5923efaec7350dc306d604..18a981dfea1bd9cc18b719ede926776a653ddd84 100644 (file)
@@ -176,7 +176,7 @@ impl<'a, 'tcx> Cx<'a, 'tcx> {
             .tcx
             .associated_items(trait_def_id)
             .filter_by_name_unhygienic(method_name)
-            .find(|item| item.kind == ty::AssocKind::Method)
+            .find(|item| item.kind == ty::AssocKind::Fn)
             .expect("trait method not found");
 
         let method_ty = self.tcx.type_of(item.def_id);
index a6d880667adf22f0576c3b81e8140f112e1e17b3..80ecf3cbd89c380b7ff18c61f5d476be4bd0d709 100644 (file)
@@ -1648,7 +1648,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
                                     found_pub_static = true;
                                     intravisit::walk_impl_item(self, impl_item);
                                 }
-                                AssocItemKind::Method { has_self: false } => {
+                                AssocItemKind::Fn { has_self: false } => {
                                     found_pub_static = true;
                                     intravisit::walk_impl_item(self, impl_item);
                                 }
@@ -1927,7 +1927,7 @@ fn check_assoc_item(
         let mut check = self.check(hir_id, vis);
 
         let (check_ty, is_assoc_ty) = match assoc_item_kind {
-            AssocItemKind::Const | AssocItemKind::Method { .. } => (true, false),
+            AssocItemKind::Const | AssocItemKind::Fn { .. } => (true, false),
             AssocItemKind::Type => (defaultness.has_value(), true),
             // `ty()` for opaque types is the underlying type,
             // it's not a part of interface, so we skip it.
index 0ad33f1a120c7a378fcf3d712466f861b2f1fb78..7e5415d000e3d55b8f64f0ed477bec19f4dcd6fd 100644 (file)
@@ -921,7 +921,7 @@ fn build_reduced_graph_for_external_crate_res(&mut self, child: Export<NodeId>)
             Res::Def(DefKind::AssocFn, def_id) => {
                 if cstore
                     .associated_item_cloned_untracked(def_id, self.r.session)
-                    .method_has_self_argument
+                    .fn_has_self_parameter
                 {
                     self.r.has_self.insert(def_id);
                 }
index 71ff9e5cbed17ed649350cc9c8962c06c6f0015b..f230eeb8fad57fbf1e996d75f91316df2b4c7a10 100644 (file)
@@ -2117,7 +2117,7 @@ fn visit_fn_like_elision(
         };
 
         let has_self = match assoc_item_kind {
-            Some(hir::AssocItemKind::Method { has_self }) => has_self,
+            Some(hir::AssocItemKind::Fn { has_self }) => has_self,
             _ => false,
         };
 
index 14029f2915141dc7cfdd389137c12a855ea52259..53e73ed3906ca4f2201463d0f6eefa38fc6659a6 100644 (file)
@@ -1029,7 +1029,7 @@ fn suggest_fully_qualified_path(
                 err.note(&format!(
                     "{}s cannot be accessed directly on a `trait`, they can only be \
                         accessed through a specific `impl`",
-                    assoc_item.kind.suggestion_descr(),
+                    assoc_item.kind.as_def_kind().descr(def_id)
                 ));
                 err.span_suggestion(
                     span,
index f5f4a51eb54e21dda7fbb984eba12bf5e26a531a..f8fc155f582b82e6d7c0611f8bf50aef4f3eb6f2 100644 (file)
@@ -475,7 +475,7 @@ fn vtable_methods<'tcx>(
         let trait_methods = tcx
             .associated_items(trait_ref.def_id())
             .in_definition_order()
-            .filter(|item| item.kind == ty::AssocKind::Method);
+            .filter(|item| item.kind == ty::AssocKind::Fn);
 
         // Now list each method's DefId and InternalSubsts (for within its trait).
         // If the method can never be called from this object, produce None.
index 2389b36f842914fdbb917a627cec512d7d18443c..d9fba1fd78392e69e11f41c2fc799729dd788311 100644 (file)
@@ -86,7 +86,7 @@ fn object_safety_violations_for_trait(
     let mut violations: Vec<_> = tcx
         .associated_items(trait_def_id)
         .in_definition_order()
-        .filter(|item| item.kind == ty::AssocKind::Method)
+        .filter(|item| item.kind == ty::AssocKind::Fn)
         .filter_map(|item| {
             object_safety_violation_for_method(tcx, trait_def_id, &item)
                 .map(|(code, span)| ObjectSafetyViolation::Method(item.ident.name, code, span))
@@ -362,7 +362,7 @@ fn virtual_call_violation_for_method<'tcx>(
     method: &ty::AssocItem,
 ) -> Option<MethodViolationCode> {
     // The method's first parameter must be named `self`
-    if !method.method_has_self_argument {
+    if !method.fn_has_self_parameter {
         // We'll attempt to provide a structured suggestion for `Self: Sized`.
         let sugg =
             tcx.hir().get_if_local(method.def_id).as_ref().and_then(|node| node.generics()).map(
index 725c41c1e2c72de04c993d4c534eac1f6875dfb8..ffece42ec306ce3e18d8cb177942b91d3aaa725c 100644 (file)
@@ -293,7 +293,7 @@ pub fn count_own_vtable_entries(tcx: TyCtxt<'tcx>, trait_ref: ty::PolyTraitRef<'
     // Count number of methods and add them to the total offset.
     // Skip over associated types and constants.
     for trait_item in tcx.associated_items(trait_ref.def_id()).in_definition_order() {
-        if trait_item.kind == ty::AssocKind::Method {
+        if trait_item.kind == ty::AssocKind::Fn {
             entries += 1;
         }
     }
@@ -315,10 +315,10 @@ pub fn get_vtable_index_of_object_method<N>(
     for trait_item in tcx.associated_items(object.upcast_trait_ref.def_id()).in_definition_order() {
         if trait_item.def_id == method_def_id {
             // The item with the ID we were given really ought to be a method.
-            assert_eq!(trait_item.kind, ty::AssocKind::Method);
+            assert_eq!(trait_item.kind, ty::AssocKind::Fn);
             return entries;
         }
-        if trait_item.kind == ty::AssocKind::Method {
+        if trait_item.kind == ty::AssocKind::Fn {
             entries += 1;
         }
     }
index aefe61f60b87a4e59b2d2effa8a9d33b1cc751d6..df2672feb8b49d7507ac98e012ede29a08fa7679 100644 (file)
@@ -85,7 +85,7 @@ fn associated_item_from_trait_item_ref(
     let def_id = tcx.hir().local_def_id(trait_item_ref.id.hir_id);
     let (kind, has_self) = match trait_item_ref.kind {
         hir::AssocItemKind::Const => (ty::AssocKind::Const, false),
-        hir::AssocItemKind::Method { has_self } => (ty::AssocKind::Method, has_self),
+        hir::AssocItemKind::Fn { has_self } => (ty::AssocKind::Fn, has_self),
         hir::AssocItemKind::Type => (ty::AssocKind::Type, false),
         hir::AssocItemKind::OpaqueTy => bug!("only impls can have opaque types"),
     };
@@ -98,7 +98,7 @@ fn associated_item_from_trait_item_ref(
         defaultness: trait_item_ref.defaultness,
         def_id,
         container: ty::TraitContainer(parent_def_id),
-        method_has_self_argument: has_self,
+        fn_has_self_parameter: has_self,
     }
 }
 
@@ -110,7 +110,7 @@ fn associated_item_from_impl_item_ref(
     let def_id = tcx.hir().local_def_id(impl_item_ref.id.hir_id);
     let (kind, has_self) = match impl_item_ref.kind {
         hir::AssocItemKind::Const => (ty::AssocKind::Const, false),
-        hir::AssocItemKind::Method { has_self } => (ty::AssocKind::Method, has_self),
+        hir::AssocItemKind::Fn { has_self } => (ty::AssocKind::Fn, has_self),
         hir::AssocItemKind::Type => (ty::AssocKind::Type, false),
         hir::AssocItemKind::OpaqueTy => (ty::AssocKind::OpaqueTy, false),
     };
@@ -123,7 +123,7 @@ fn associated_item_from_impl_item_ref(
         defaultness: impl_item_ref.defaultness,
         def_id,
         container: ty::ImplContainer(parent_def_id),
-        method_has_self_argument: has_self,
+        fn_has_self_parameter: has_self,
     }
 }
 
index 24db25a1f345618eb3bc5a811ae03e5b594abcf7..82c8a5543eb3340cfa2bbca1d1e55388409d7029 100644 (file)
@@ -516,7 +516,7 @@ fn compare_self_type<'tcx>(
         })
     };
 
-    match (trait_m.method_has_self_argument, impl_m.method_has_self_argument) {
+    match (trait_m.fn_has_self_parameter, impl_m.fn_has_self_parameter) {
         (false, false) | (true, true) => {}
 
         (false, true) => {
@@ -1163,7 +1163,7 @@ fn compare_type_predicate_entailment(
 fn assoc_item_kind_str(impl_item: &ty::AssocItem) -> &'static str {
     match impl_item.kind {
         ty::AssocKind::Const => "const",
-        ty::AssocKind::Method => "method",
+        ty::AssocKind::Fn => "method",
         ty::AssocKind::Type | ty::AssocKind::OpaqueTy => "type",
     }
 }
index 2f890d4dabb5b813922ec9d942da374402891c10..7cbc68272dab2e490efc3bc13aae03fd59be0fdb 100644 (file)
@@ -250,9 +250,7 @@ pub fn get_conversion_methods(
     // This function checks if the method isn't static and takes other arguments than `self`.
     fn has_no_input_arg(&self, method: &AssocItem) -> bool {
         match method.kind {
-            ty::AssocKind::Method => {
-                self.tcx.fn_sig(method.def_id).inputs().skip_binder().len() == 1
-            }
+            ty::AssocKind::Fn => self.tcx.fn_sig(method.def_id).inputs().skip_binder().len() == 1,
             _ => false,
         }
     }
index deaff19de08d3322fcadcbd87947f622f945309d..13fc3900e480c73a7fae66ab1eafb0d980c8fc29 100644 (file)
@@ -467,7 +467,7 @@ pub fn resolve_ufcs(
             }
         }
 
-        let def_kind = pick.item.def_kind();
+        let def_kind = pick.item.kind.as_def_kind();
         debug!("resolve_ufcs: def_kind={:?}, def_id={:?}", def_kind, pick.item.def_id);
         tcx.check_stability(pick.item.def_id, Some(expr_id), span);
         Ok((def_kind, pick.item.def_id))
index fb1cde855657bcba494c36634b7bee82eb720c67..746738aed789d18d1c0e9c59f39507051f395c60 100644 (file)
@@ -570,7 +570,8 @@ fn push_candidate(&mut self, candidate: Candidate<'tcx>, is_inherent: bool) {
                 self.extension_candidates.push(candidate);
             }
         } else if self.private_candidate.is_none() {
-            self.private_candidate = Some((candidate.item.def_kind(), candidate.item.def_id));
+            self.private_candidate =
+                Some((candidate.item.kind.as_def_kind(), candidate.item.def_id));
         }
     }
 
@@ -896,7 +897,7 @@ pub fn matches_return_type(
         expected: Ty<'tcx>,
     ) -> bool {
         match method.kind {
-            ty::AssocKind::Method => {
+            ty::AssocKind::Fn => {
                 let fty = self.tcx.fn_sig(method.def_id);
                 self.probe(|_| {
                     let substs = self.fresh_substs_for_item(self.span, method.def_id);
@@ -1553,10 +1554,10 @@ fn has_applicable_self(&self, item: &ty::AssocItem) -> bool {
         // In Path mode (i.e., resolving a value like `T::next`), consider any
         // associated value (i.e., methods, constants) but not types.
         match self.mode {
-            Mode::MethodCall => item.method_has_self_argument,
+            Mode::MethodCall => item.fn_has_self_parameter,
             Mode::Path => match item.kind {
                 ty::AssocKind::OpaqueTy | ty::AssocKind::Type => false,
-                ty::AssocKind::Method | ty::AssocKind::Const => true,
+                ty::AssocKind::Fn | ty::AssocKind::Const => true,
             },
         }
         // FIXME -- check for types that deref to `Self`,
@@ -1577,7 +1578,7 @@ fn xform_self_ty(
         impl_ty: Ty<'tcx>,
         substs: SubstsRef<'tcx>,
     ) -> (Ty<'tcx>, Option<Ty<'tcx>>) {
-        if item.kind == ty::AssocKind::Method && self.mode == Mode::MethodCall {
+        if item.kind == ty::AssocKind::Fn && self.mode == Mode::MethodCall {
             let sig = self.xform_method_sig(item.def_id, substs);
             (sig.inputs()[0], Some(sig.output()))
         } else {
index 6e33acf9afccba90f9f6d2237b4562a90cc5b02b..edde9b1a1a12f9918d2b7d7ee85697a1c21d23e2 100644 (file)
@@ -162,7 +162,7 @@ pub fn report_method_error<'b>(
                                 ty::AssocKind::Const
                                 | ty::AssocKind::Type
                                 | ty::AssocKind::OpaqueTy => rcvr_ty,
-                                ty::AssocKind::Method => self
+                                ty::AssocKind::Fn => self
                                     .tcx
                                     .fn_sig(item.def_id)
                                     .inputs()
@@ -179,6 +179,7 @@ pub fn report_method_error<'b>(
                                 path,
                                 ty,
                                 item.kind,
+                                item.def_id,
                                 sugg_span,
                                 idx,
                                 self.tcx.sess.source_map(),
@@ -220,6 +221,7 @@ pub fn report_method_error<'b>(
                             path,
                             rcvr_ty,
                             item.kind,
+                            item.def_id,
                             sugg_span,
                             idx,
                             self.tcx.sess.source_map(),
@@ -764,7 +766,7 @@ trait bound{s}",
                         err.span_label(span, msg);
                     }
                 } else if let Some(lev_candidate) = lev_candidate {
-                    let def_kind = lev_candidate.def_kind();
+                    let def_kind = lev_candidate.kind.as_def_kind();
                     err.span_suggestion(
                         span,
                         &format!(
@@ -957,7 +959,7 @@ fn suggest_traits_to_import<'b>(
                     && self
                         .associated_item(info.def_id, item_name, Namespace::ValueNS)
                         .filter(|item| {
-                            if let ty::AssocKind::Method = item.kind {
+                            if let ty::AssocKind::Fn = item.kind {
                                 let id = self.tcx.hir().as_local_hir_id(item.def_id);
                                 if let Some(hir::Node::TraitItem(hir::TraitItem {
                                     kind: hir::TraitItemKind::Fn(fn_sig, method),
@@ -1387,12 +1389,13 @@ fn print_disambiguation_help(
     trait_name: String,
     rcvr_ty: Ty<'_>,
     kind: ty::AssocKind,
+    def_id: DefId,
     span: Span,
     candidate: Option<usize>,
     source_map: &source_map::SourceMap,
 ) {
     let mut applicability = Applicability::MachineApplicable;
-    let sugg_args = if let (ty::AssocKind::Method, Some(args)) = (kind, args) {
+    let sugg_args = if let (ty::AssocKind::Fn, Some(args)) = (kind, args) {
         format!(
             "({}{})",
             if rcvr_ty.is_region_ptr() {
@@ -1416,7 +1419,7 @@ fn print_disambiguation_help(
         span,
         &format!(
             "disambiguate the {} for {}",
-            kind.suggestion_descr(),
+            kind.as_def_kind().descr(def_id),
             if let Some(candidate) = candidate {
                 format!("candidate #{}", candidate)
             } else {
index 3aea6b2815fe401684a4571a2a61fba5c80bc64f..47d7d7fb2fc87d34cb352cba11bea5fe08cfec88 100644 (file)
@@ -1903,7 +1903,7 @@ fn check_specialization_validity<'tcx>(
 ) {
     let kind = match impl_item.kind {
         hir::ImplItemKind::Const(..) => ty::AssocKind::Const,
-        hir::ImplItemKind::Fn(..) => ty::AssocKind::Method,
+        hir::ImplItemKind::Fn(..) => ty::AssocKind::Fn,
         hir::ImplItemKind::OpaqueTy(..) => ty::AssocKind::OpaqueTy,
         hir::ImplItemKind::TyAlias(_) => ty::AssocKind::Type,
     };
@@ -2049,7 +2049,7 @@ fn check_impl_items_against_trait<'tcx>(
                 }
                 hir::ImplItemKind::Fn(..) => {
                     let opt_trait_span = tcx.hir().span_if_local(ty_trait_item.def_id);
-                    if ty_trait_item.kind == ty::AssocKind::Method {
+                    if ty_trait_item.kind == ty::AssocKind::Fn {
                         compare_impl_method(
                             tcx,
                             &ty_impl_item,
@@ -2295,7 +2295,7 @@ fn fn_sig_suggestion(
 /// structured suggestion.
 fn suggestion_signature(assoc: &ty::AssocItem, tcx: TyCtxt<'_>) -> String {
     match assoc.kind {
-        ty::AssocKind::Method => {
+        ty::AssocKind::Fn => {
             // We skip the binder here because the binder would deanonymize all
             // late-bound regions, and we don't want method signatures to show up
             // `as for<'r> fn(&'r MyType)`.  Pretty-printing handles late-bound
index 6b6e2bb329fc904aea3cd61ed8184fa0f52d4861..32004744ff950bfa67a4c731c291ba6c716fb710 100644 (file)
@@ -294,7 +294,7 @@ fn check_associated_item(
                 let ty = fcx.normalize_associated_types_in(span, &ty);
                 fcx.register_wf_obligation(ty, span, code.clone());
             }
-            ty::AssocKind::Method => {
+            ty::AssocKind::Fn => {
                 let sig = fcx.tcx.fn_sig(item.def_id);
                 let sig = fcx.normalize_associated_types_in(span, &sig);
                 let hir_sig = sig_if_method.expect("bad signature for method");
@@ -985,7 +985,7 @@ fn check_method_receiver<'fcx, 'tcx>(
     // Check that the method has a valid receiver type, given the type `Self`.
     debug!("check_method_receiver({:?}, self_ty={:?})", method, self_ty);
 
-    if !method.method_has_self_argument {
+    if !method.fn_has_self_parameter {
         return;
     }
 
index 8ae779a4783bb7783096d1c9cb0e3ff011219872..43fea82608ef4a1694861e5c70f2a0c2cd375ae3 100644 (file)
@@ -2583,7 +2583,7 @@ fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
                     .associated_items(trait_def_id)
                     .filter_by_name_unhygienic(impl_item.ident.name)
                     .find(move |trait_item| {
-                        trait_item.kind == ty::AssocKind::Method
+                        trait_item.kind == ty::AssocKind::Fn
                             && tcx.hygienic_eq(impl_item.ident, trait_item.ident, trait_def_id)
                     })
                 {
index 0635ad5babcd8ab8911bded44bbe9c578fd71166..319f32385137203ad50e4349fd8ce4789d5fd4e7 100644 (file)
@@ -147,7 +147,7 @@ fn enforce_impl_params_are_constrained(
                     let predicates = tcx.predicates_of(def_id).instantiate_identity(tcx);
                     cgp::parameters_for(&predicates, true)
                 }
-                ty::AssocKind::Method | ty::AssocKind::Const => Vec::new(),
+                ty::AssocKind::Fn | ty::AssocKind::Const => Vec::new(),
             }
         })
         .collect();
index 59297df8e4843b84c0e44cacf37ff94268404a91..0f52feda2a303a76835e45dd0284aa8a4fa87cfd 100644 (file)
@@ -1174,14 +1174,14 @@ fn clean(&self, cx: &DocContext<'_>) -> Item {
                 };
                 AssocConstItem(ty.clean(cx), default)
             }
-            ty::AssocKind::Method => {
+            ty::AssocKind::Fn => {
                 let generics =
                     (cx.tcx.generics_of(self.def_id), cx.tcx.explicit_predicates_of(self.def_id))
                         .clean(cx);
                 let sig = cx.tcx.fn_sig(self.def_id);
                 let mut decl = (self.def_id, sig).clean(cx);
 
-                if self.method_has_self_argument {
+                if self.fn_has_self_parameter {
                     let self_ty = match self.container {
                         ty::ImplContainer(def_id) => cx.tcx.type_of(def_id),
                         ty::TraitContainer(_) => cx.tcx.types.self_param,
index a6b24d49a83aef53df267d0e6a4551668148bc8f..1821635bde48fddc70f6fb11f8358dee9da10cf3 100644 (file)
@@ -209,7 +209,7 @@ fn resolve(
                     .filter_by_name_unhygienic(item_name)
                     .next()
                     .and_then(|item| match item.kind {
-                        ty::AssocKind::Method => Some("method"),
+                        ty::AssocKind::Fn => Some("method"),
                         _ => None,
                     })
                     .map(|out| (prim, Some(format!("{}#{}.{}", path, out, item_name))))
@@ -238,12 +238,12 @@ fn resolve(
                         .find(|item| item.ident.name == item_name);
                     if let Some(item) = item {
                         let out = match item.kind {
-                            ty::AssocKind::Method if ns == ValueNS => "method",
+                            ty::AssocKind::Fn if ns == ValueNS => "method",
                             ty::AssocKind::Const if ns == ValueNS => "associatedconstant",
                             _ => return self.variant_field(path_str, current_item, module_id),
                         };
                         if extra_fragment.is_some() {
-                            Err(ErrorKind::AnchorFailure(if item.kind == ty::AssocKind::Method {
+                            Err(ErrorKind::AnchorFailure(if item.kind == ty::AssocKind::Fn {
                                 "methods cannot be followed by anchors"
                             } else {
                                 "associated constants cannot be followed by anchors"
@@ -298,14 +298,15 @@ fn resolve(
                         .map(|item| cx.tcx.associated_item(*item))
                         .find(|item| item.ident.name == item_name);
                     if let Some(item) = item {
-                        let kind = match item.kind {
-                            ty::AssocKind::Const if ns == ValueNS => "associatedconstant",
-                            ty::AssocKind::Type if ns == TypeNS => "associatedtype",
-                            ty::AssocKind::Method if ns == ValueNS => {
-                                if item.defaultness.has_value() { "method" } else { "tymethod" }
-                            }
-                            _ => return self.variant_field(path_str, current_item, module_id),
-                        };
+                        let kind =
+                            match item.kind {
+                                ty::AssocKind::Const if ns == ValueNS => "associatedconstant",
+                                ty::AssocKind::Type if ns == TypeNS => "associatedtype",
+                                ty::AssocKind::Fn if ns == ValueNS => {
+                                    if item.defaultness.has_value() { "method" } else { "tymethod" }
+                                }
+                                _ => return self.variant_field(path_str, current_item, module_id),
+                            };
 
                         if extra_fragment.is_some() {
                             Err(ErrorKind::AnchorFailure(if item.kind == ty::AssocKind::Const {
index 7977e529a11a6c140a94b503899af83ff4003dd3..471512ca8f72ceb69ad59a805edb0f5634c3ff88 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `Trait2` for the type `Tes
    |
 LL |     fn foo() {}
    |     ^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     Trait1::foo()
    |     ^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     Trait2::foo()
    |     ^^^^^^^^^^^
index fa908440e41ea6833779f21525f09ae516c0e9fd..e23b934ac187f72a2a406c714659449aa70c1f77 100644 (file)
@@ -6,11 +6,11 @@ LL |     assert_eq!('x'.ipu_flatten(), 0);
    |
    = note: candidate #1 is defined in an impl of the trait `inference_unstable_iterator::IpuIterator` for the type `char`
    = note: candidate #2 is defined in an impl of the trait `inference_unstable_itertools::IpuItertools` for the type `char`
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     assert_eq!(inference_unstable_iterator::IpuIterator::ipu_flatten(&'x'), 0);
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     assert_eq!(inference_unstable_itertools::IpuItertools::ipu_flatten(&'x'), 0);
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index 40cb86e5716a0b3a6aeac905242d90d9856ae406..11c8cfdcf66a5ff2f4bb8bf58b3825d77d598d5f 100644 (file)
@@ -5,7 +5,7 @@ LL |     x.foo();
    |     --^^^--
    |     | |
    |     | multiple `foo` found
-   |     help: disambiguate the method call for candidate #2: `T::foo(&x)`
+   |     help: disambiguate the associated function for candidate #2: `T::foo(&x)`
    |
 note: candidate #1 is defined in an impl for the type `(dyn T + 'a)`
   --> $DIR/issue-18446.rs:9:5
index b18e407c3d464d9f3b03bf8533becd860cee5154..6d8d17292f2d1758a8103968e3f94f4e6dc82586 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `Add` for the type `isize`
    |
 LL |     fn to_int(&self) -> isize { *self }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |         ToPrimitive::to_int(&self) + other.to_int()
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |         Add::to_int(&self) + other.to_int()
    |         ^^^^^^^^^^^^^^^^^^
index feaf3dc753ffbaf89dbb00fe0c159066d12f7402..83d8770b2e03b07e00342abed1c63c5f5d847b6b 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `await` for the type `r#fn
    |
 LL |     fn r#struct(&self) {
    |     ^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     async::r#struct(&r#fn {});
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     await::r#struct(&r#fn {});
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^
index fa3add81a28f5af1b5db7e4d5981fb50da301cca..1b354fc697adc93c9c67caad69054e60945e78f3 100644 (file)
@@ -10,11 +10,11 @@ note: candidate #1 is defined in an impl of the trait `Me2` for the type `usize`
 LL | impl Me2 for usize { fn me(&self) -> usize { *self } }
    |                      ^^^^^^^^^^^^^^^^^^^^^
    = note: candidate #2 is defined in an impl of the trait `ambig_impl_2_lib::Me` for the type `usize`
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL | fn main() { Me2::me(&1_usize); }
    |             ^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL | fn main() { ambig_impl_2_lib::Me::me(&1_usize); }
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index b6c81c2377ee44ddc634943690d08d12dff3bea4..5cbed652b0a40a30555060e95a8f3754473f36f3 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in the trait `B`
    |
 LL | trait B { fn foo(&self); }
    |           ^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     A::foo(t);
    |     ^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     B::foo(t);
    |     ^^^^^^^^^
index 71c65f7ccc68d3229fd3187cffc790d6b0d3bdbe..8585929934e31c8a21209e5e1741aa668e9a40dd 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `AB`
    |
 LL |     fn foo(self) {}
    |     ^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     A::foo(AB {});
    |     ^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     B::foo(AB {});
    |     ^^^^^^^^^^^^^
index 249464108875c5b96218435586524d45903fd08d..85b39647885909a538de562977a5a3c18a8ae30e 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `AB`
    |
 LL |     fn foo() {}
    |     ^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     A::foo();
    |     ^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     B::foo();
    |     ^^^^^^
index 3dbb17371004a9706fa9b7b0e96ecade7aeddef4..4ce7236ed96c584a512616975536c119ca9cc62d 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `Bar` for the type `usize`
    |
 LL | trait Bar { fn method(&self) {} }
    |             ^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     Foo::method(&1_usize);
    |     ^^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     Bar::method(&1_usize);
    |     ^^^^^^^^^^^^^^^^^^^^^
index f6820be7e7709e957e4fdf0062deae16cc7ea533..1bc7f30d04d0d7476e9719e3eedbcb845d6715ac 100644 (file)
@@ -35,15 +35,15 @@ note: candidate #3 is defined in the trait `FinalFoo`
    |
 LL |     fn foo(&self) -> u8;
    |     ^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     let z = internal::X::foo(x);
    |             ^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     let z = nuisance_foo::NuisanceFoo::foo(x);
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #3
+help: disambiguate the associated function for candidate #3
    |
 LL |     let z = FinalFoo::foo(x);
    |             ^^^^^^^^^^^^^^^^
index 9ed6c8b826f79f04b2e59f40ace4832c7846ad91..fc6c556c16d888a7e68b55086835b554ab69cdc3 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in the trait `B`
    |
 LL |     fn foo(&mut self) {}
    |     ^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     A::foo(&a)
    |     ^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     B::foo(&a)
    |     ^^^^^^^^^^
@@ -39,11 +39,11 @@ note: candidate #2 is defined in the trait `D`
    |
 LL |     fn foo(&self) {}
    |     ^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     C::foo(&a)
    |     ^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     D::foo(&a)
    |     ^^^^^^^^^^
@@ -64,11 +64,11 @@ note: candidate #2 is defined in the trait `F`
    |
 LL |     fn foo(self) {}
    |     ^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     E::foo(a)
    |     ^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     F::foo(a)
    |     ^^^^^^^^^
index 89b36848a2897c2d6ebc4c4fd3cf38f7d5a12fcc..16a1ac6d71814c8381b1eadfab05c97cda53cdf2 100644 (file)
@@ -25,15 +25,15 @@ LL |     fn f9(_: usize) -> usize;
            candidate #1: `CtxtFn`
            candidate #2: `OtherTrait`
            candidate #3: `UnusedTrait`
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     u.f8(42) + CtxtFn::f9(u, 342) + m.fff(42)
    |                ^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     u.f8(42) + OtherTrait::f9(u, 342) + m.fff(42)
    |                ^^^^^^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #3
+help: disambiguate the associated function for candidate #3
    |
 LL |     u.f8(42) + UnusedTrait::f9(u, 342) + m.fff(42)
    |                ^^^^^^^^^^^^^^^^^^^^^^^
@@ -64,7 +64,7 @@ LL |     t.is_str()
    |     --^^^^^^--
    |     | |
    |     | this is an associated function, not a method
-   |     help: disambiguate the method call for the candidate: `ManyImplTrait::is_str(t)`
+   |     help: disambiguate the associated function for the candidate: `ManyImplTrait::is_str(t)`
    |
    = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
 note: the candidate is defined in the trait `ManyImplTrait`
index 48a029104aeca8842485eef2035c67c3a644ac86..7c00bb5207bdfdff9a53a7a442d12c193175638f 100644 (file)
@@ -14,11 +14,11 @@ note: candidate #2 is defined in an impl of the trait `inner::B` for the type `u
    |
 LL |         fn foo(&self) {}
    |         ^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #1
+help: disambiguate the associated function for candidate #1
    |
 LL |     inner::A::foo(&t);
    |     ^^^^^^^^^^^^^^^^^
-help: disambiguate the method call for candidate #2
+help: disambiguate the associated function for candidate #2
    |
 LL |     inner::B::foo(&t);
    |     ^^^^^^^^^^^^^^^^^