diff --git a/src/librustc_ast_lowering/item.rs b/src/librustc_ast_lowering/item.rs index 9779954d759..c535885e70c 100644 --- a/src/librustc_ast_lowering/item.rs +++ b/src/librustc_ast_lowering/item.rs @@ -796,7 +796,7 @@ impl<'hir> LoweringContext<'_, 'hir> { (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 @@ impl<'hir> LoweringContext<'_, '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!(), }, diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs index b719d576d6f..172d1e263ea 100644 --- a/src/librustc_hir/hir.rs +++ b/src/librustc_hir/hir.rs @@ -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, } diff --git a/src/librustc_infer/infer/error_reporting/nice_region_error/util.rs b/src/librustc_infer/infer/error_reporting/nice_region_error/util.rs index d35a589320b..7bbd2127bcf 100644 --- a/src/librustc_infer/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc_infer/infer/error_reporting/nice_region_error/util.rs @@ -118,7 +118,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { // 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) } } diff --git a/src/librustc_metadata/rmeta/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs index 078f9251adf..ef6f37c5dab 100644 --- a/src/librustc_metadata/rmeta/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -1153,7 +1153,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { 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 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { 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, } } diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index d75298fae00..9c9869c8557 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -839,7 +839,7 @@ impl EncodeContext<'tcx> { 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 @@ impl EncodeContext<'tcx> { 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 @@ impl EncodeContext<'tcx> { 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 @@ impl EncodeContext<'tcx> { } 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 @@ impl EncodeContext<'tcx> { 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 @@ impl EncodeContext<'tcx> { 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 @@ impl EncodeContext<'tcx> { 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); } diff --git a/src/librustc_middle/traits/specialization_graph.rs b/src/librustc_middle/traits/specialization_graph.rs index a2793f98050..bc743666e4a 100644 --- a/src/librustc_middle/traits/specialization_graph.rs +++ b/src/librustc_middle/traits/specialization_graph.rs @@ -107,13 +107,13 @@ impl<'tcx> Node { .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, diff --git a/src/librustc_middle/ty/adjustment.rs b/src/librustc_middle/ty/adjustment.rs index 851bffc2065..efd5adeba8c 100644 --- a/src/librustc_middle/ty/adjustment.rs +++ b/src/librustc_middle/ty/adjustment.rs @@ -123,7 +123,7 @@ impl<'tcx> OverloadedDeref<'tcx> { 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, &[])) diff --git a/src/librustc_middle/ty/instance.rs b/src/librustc_middle/ty/instance.rs index 894f9070ce1..ca76cfb1492 100644 --- a/src/librustc_middle/ty/instance.rs +++ b/src/librustc_middle/ty/instance.rs @@ -366,7 +366,7 @@ impl<'tcx> Instance<'tcx> { 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 }; diff --git a/src/librustc_middle/ty/mod.rs b/src/librustc_middle/ty/mod.rs index 0e6c4f26222..8d50f560a83 100644 --- a/src/librustc_middle/ty/mod.rs +++ b/src/librustc_middle/ty/mod.rs @@ -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, + } + } + + pub fn as_def_kind(&self) -> DefKind { + match self { + AssocKind::Const => DefKind::AssocConst, + AssocKind::Fn => DefKind::AssocFn, + AssocKind::Type => DefKind::AssocTy, + AssocKind::OpaqueTy => DefKind::AssocOpaqueTy, } } } impl AssocItem { - pub fn def_kind(&self) -> DefKind { - match self.kind { - AssocKind::Const => DefKind::AssocConst, - AssocKind::Method => DefKind::AssocFn, - AssocKind::Type => DefKind::AssocTy, - AssocKind::OpaqueTy => DefKind::AssocOpaqueTy, - } - } - /// 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 @@ impl<'tcx> TyCtxt<'tcx> { pub fn provided_trait_methods(self, id: DefId) -> impl 'tcx + Iterator { 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 { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 67de81ed77b..e1473cbfb63 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -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; diff --git a/src/librustc_mir_build/hair/cx/mod.rs b/src/librustc_mir_build/hair/cx/mod.rs index 503bd26d51f..18a981dfea1 100644 --- a/src/librustc_mir_build/hair/cx/mod.rs +++ b/src/librustc_mir_build/hair/cx/mod.rs @@ -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); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index e02e97be19d..84f041ee9f8 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1648,7 +1648,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, '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 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { 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. diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 0ad33f1a120..7e5415d000e 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -921,7 +921,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { 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); } diff --git a/src/librustc_resolve/late/lifetimes.rs b/src/librustc_resolve/late/lifetimes.rs index 71ff9e5cbed..f230eeb8fad 100644 --- a/src/librustc_resolve/late/lifetimes.rs +++ b/src/librustc_resolve/late/lifetimes.rs @@ -2117,7 +2117,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { }; let has_self = match assoc_item_kind { - Some(hir::AssocItemKind::Method { has_self }) => has_self, + Some(hir::AssocItemKind::Fn { has_self }) => has_self, _ => false, }; diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index 14029f29151..53e73ed3906 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -1029,7 +1029,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { 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, diff --git a/src/librustc_trait_selection/traits/mod.rs b/src/librustc_trait_selection/traits/mod.rs index f5f4a51eb54..f8fc155f582 100644 --- a/src/librustc_trait_selection/traits/mod.rs +++ b/src/librustc_trait_selection/traits/mod.rs @@ -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. diff --git a/src/librustc_trait_selection/traits/object_safety.rs b/src/librustc_trait_selection/traits/object_safety.rs index 2389b36f842..d9fba1fd783 100644 --- a/src/librustc_trait_selection/traits/object_safety.rs +++ b/src/librustc_trait_selection/traits/object_safety.rs @@ -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 { // 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( diff --git a/src/librustc_trait_selection/traits/util.rs b/src/librustc_trait_selection/traits/util.rs index 725c41c1e2c..ffece42ec30 100644 --- a/src/librustc_trait_selection/traits/util.rs +++ b/src/librustc_trait_selection/traits/util.rs @@ -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( 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; } } diff --git a/src/librustc_ty/ty.rs b/src/librustc_ty/ty.rs index 4cb7b7d8fda..43ff39f92f7 100644 --- a/src/librustc_ty/ty.rs +++ b/src/librustc_ty/ty.rs @@ -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, } } diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 24db25a1f34..82c8a5543eb 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -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", } } diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 0a7d87adac7..be45ada866f 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -246,9 +246,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // 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, } } diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index deaff19de08..13fc3900e48 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -467,7 +467,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - 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)) diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 66a6790d45e..b5d3f7b5502 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -570,7 +570,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { 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 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { 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); @@ -1549,10 +1550,10 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { // 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`, @@ -1573,7 +1574,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { impl_ty: Ty<'tcx>, substs: SubstsRef<'tcx>, ) -> (Ty<'tcx>, Option>) { - 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 { diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 6e33acf9afc..edde9b1a1a1 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -162,7 +162,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { 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 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { path, ty, item.kind, + item.def_id, sugg_span, idx, self.tcx.sess.source_map(), @@ -220,6 +221,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { path, rcvr_ty, item.kind, + item.def_id, sugg_span, idx, self.tcx.sess.source_map(), @@ -764,7 +766,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { 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 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && 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, 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 { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 514186ba9a1..2db397d5c74 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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 diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 6b6e2bb329f..32004744ff9 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -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; } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 8ae779a4783..43fea82608e 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -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) }) { diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 0635ad5babc..319f3238513 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -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(); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 59297df8e48..0f52feda2a3 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1174,14 +1174,14 @@ impl Clean for ty::AssocItem { }; 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, diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index a6b24d49a83..1821635bde4 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -209,7 +209,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { .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 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { .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 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> { .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 { diff --git a/src/test/ui/error-codes/E0034.stderr b/src/test/ui/error-codes/E0034.stderr index 7977e529a11..471512ca8f7 100644 --- a/src/test/ui/error-codes/E0034.stderr +++ b/src/test/ui/error-codes/E0034.stderr @@ -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() | ^^^^^^^^^^^ diff --git a/src/test/ui/inference/inference_unstable_featured.stderr b/src/test/ui/inference/inference_unstable_featured.stderr index fa908440e41..e23b934ac18 100644 --- a/src/test/ui/inference/inference_unstable_featured.stderr +++ b/src/test/ui/inference/inference_unstable_featured.stderr @@ -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); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-18446.stderr b/src/test/ui/issues/issue-18446.stderr index 40cb86e5716..11c8cfdcf66 100644 --- a/src/test/ui/issues/issue-18446.stderr +++ b/src/test/ui/issues/issue-18446.stderr @@ -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 diff --git a/src/test/ui/issues/issue-3702-2.stderr b/src/test/ui/issues/issue-3702-2.stderr index b18e407c3d4..6d8d17292f2 100644 --- a/src/test/ui/issues/issue-3702-2.stderr +++ b/src/test/ui/issues/issue-3702-2.stderr @@ -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() | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr b/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr index feaf3dc753f..83d8770b2e0 100644 --- a/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr +++ b/src/test/ui/issues/issue-65634-raw-ident-suggestion.stderr @@ -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 {}); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr index fa3add81a28..1b354fc697a 100644 --- a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr @@ -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); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr index b6c81c2377e..5cbed652b0a 100644 --- a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr @@ -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); | ^^^^^^^^^ diff --git a/src/test/ui/methods/method-ambig-two-traits-from-impls.stderr b/src/test/ui/methods/method-ambig-two-traits-from-impls.stderr index 71c65f7ccc6..8585929934e 100644 --- a/src/test/ui/methods/method-ambig-two-traits-from-impls.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-from-impls.stderr @@ -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 {}); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/methods/method-ambig-two-traits-from-impls2.stderr b/src/test/ui/methods/method-ambig-two-traits-from-impls2.stderr index 24946410887..85b39647885 100644 --- a/src/test/ui/methods/method-ambig-two-traits-from-impls2.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-from-impls2.stderr @@ -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(); | ^^^^^^ diff --git a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr index 3dbb1737100..4ce7236ed96 100644 --- a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr @@ -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); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr index f6820be7e77..1bc7f30d04d 100644 --- a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -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); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/span/issue-37767.stderr b/src/test/ui/span/issue-37767.stderr index 9ed6c8b826f..fc6c556c16d 100644 --- a/src/test/ui/span/issue-37767.stderr +++ b/src/test/ui/span/issue-37767.stderr @@ -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) | ^^^^^^^^^ diff --git a/src/test/ui/span/issue-7575.stderr b/src/test/ui/span/issue-7575.stderr index 89b36848a28..16a1ac6d718 100644 --- a/src/test/ui/span/issue-7575.stderr +++ b/src/test/ui/span/issue-7575.stderr @@ -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` diff --git a/src/test/ui/traits/trait-alias-ambiguous.stderr b/src/test/ui/traits/trait-alias-ambiguous.stderr index 48a029104ae..7c00bb5207b 100644 --- a/src/test/ui/traits/trait-alias-ambiguous.stderr +++ b/src/test/ui/traits/trait-alias-ambiguous.stderr @@ -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); | ^^^^^^^^^^^^^^^^^