Auto merge of #70643 - Rustin-Liu:rustin-patch-rename, r=eddyb
Rename AssocKind::Method to AssocKind::Fn Part of https://github.com/rust-lang/rust/issues/60163. https://github.com/rust-lang/rust/issues/60163#issuecomment-607284413
This commit is contained in:
commit
513a6473d6
@ -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!(),
|
||||
},
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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, &[]))
|
||||
|
@ -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 };
|
||||
|
@ -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<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 {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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))
|
||||
|
@ -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<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 {
|
||||
|
@ -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<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 {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
})
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -1174,14 +1174,14 @@ impl Clean<Item> 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,
|
||||
|
@ -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 {
|
||||
|
@ -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()
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -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);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
@ -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 {});
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -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); }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -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);
|
||||
| ^^^^^^^^^
|
||||
|
@ -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 {});
|
||||
| ^^^^^^^^^^^^^
|
||||
|
@ -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();
|
||||
| ^^^^^^
|
||||
|
@ -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);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -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);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -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)
|
||||
| ^^^^^^^^^
|
||||
|
@ -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`
|
||||
|
@ -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);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user