Skip to content

Commit b43164c

Browse files
committed
Rename impl_of_method -> impl_of_assoc
1 parent 172af03 commit b43164c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+45
-45
lines changed

compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
682682
}
683683
let my_def = self.body.source.def_id();
684684
let Some(td) =
685-
self.infcx.tcx.impl_of_method(my_def).and_then(|x| self.infcx.tcx.trait_id_of_impl(x))
685+
self.infcx.tcx.impl_of_assoc(my_def).and_then(|x| self.infcx.tcx.trait_id_of_impl(x))
686686
else {
687687
return (false, false, None);
688688
};
@@ -880,7 +880,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
880880
let opt_suggestions = tcx
881881
.typeck(path_segment.hir_id.owner.def_id)
882882
.type_dependent_def_id(expr.hir_id)
883-
.and_then(|def_id| tcx.impl_of_method(def_id))
883+
.and_then(|def_id| tcx.impl_of_assoc(def_id))
884884
.map(|def_id| tcx.associated_items(def_id))
885885
.map(|assoc_items| {
886886
assoc_items
@@ -1056,7 +1056,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10561056
.tcx
10571057
.typeck(path_segment.hir_id.owner.def_id)
10581058
.type_dependent_def_id(cur_expr.hir_id)
1059-
.and_then(|def_id| self.infcx.tcx.impl_of_method(def_id))
1059+
.and_then(|def_id| self.infcx.tcx.impl_of_assoc(def_id))
10601060
.map(|def_id| self.infcx.tcx.associated_items(def_id))
10611061
.map(|assoc_items| {
10621062
assoc_items.filter_by_name_unhygienic(sym::iter_mut).peekable()

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
17611761
);
17621762

17631763
assert!(!matches!(
1764-
tcx.impl_of_method(def_id).map(|imp| tcx.def_kind(imp)),
1764+
tcx.impl_of_assoc(def_id).map(|imp| tcx.def_kind(imp)),
17651765
Some(DefKind::Impl { of_trait: true })
17661766
));
17671767
self.prove_predicates(

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
533533
// First, let's see if this is a method within an inherent impl. Because
534534
// if yes, we want to make the result subroutine DIE a child of the
535535
// subroutine's self-type.
536-
if let Some(impl_def_id) = cx.tcx.impl_of_method(instance.def_id()) {
536+
if let Some(impl_def_id) = cx.tcx.impl_of_assoc(instance.def_id()) {
537537
// If the method does *not* belong to a trait, proceed
538538
if cx.tcx.trait_id_of_impl(impl_def_id).is_none() {
539539
let impl_self_ty = cx.tcx.instantiate_and_normalize_erasing_regions(

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
8686
// Only consider nodes that actually have exported symbols.
8787
match tcx.def_kind(def_id) {
8888
DefKind::Fn | DefKind::Static { .. } => {}
89-
DefKind::AssocFn if tcx.impl_of_method(def_id.to_def_id()).is_some() => {}
89+
DefKind::AssocFn if tcx.impl_of_assoc(def_id.to_def_id()).is_some() => {}
9090
_ => return None,
9191
};
9292

compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
755755
let limit = if candidates.len() == 5 { 5 } else { 4 };
756756

757757
for (index, &item) in candidates.iter().take(limit).enumerate() {
758-
let impl_ = tcx.impl_of_method(item).unwrap();
758+
let impl_ = tcx.impl_of_assoc(item).unwrap();
759759

760760
let note_span = if item.is_local() {
761761
Some(tcx.def_span(item))

compiler/rustc_lint/src/map_unit_fn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for MapUnitFn {
9696

9797
fn is_impl_slice(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
9898
if let Some(method_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
99-
&& let Some(impl_id) = cx.tcx.impl_of_method(method_id)
99+
&& let Some(impl_id) = cx.tcx.impl_of_assoc(method_id)
100100
{
101101
return cx.tcx.type_of(impl_id).skip_binder().is_slice();
102102
}

compiler/rustc_lint/src/pass_by_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'tcx> LateLintPass<'tcx> for PassByValue {
2424
fn check_ty(&mut self, cx: &LateContext<'_>, ty: &'tcx hir::Ty<'tcx, AmbigArg>) {
2525
match &ty.kind {
2626
TyKind::Ref(_, hir::MutTy { ty: inner_ty, mutbl: hir::Mutability::Not }) => {
27-
if let Some(impl_did) = cx.tcx.impl_of_method(ty.hir_id.owner.to_def_id()) {
27+
if let Some(impl_did) = cx.tcx.impl_of_assoc(ty.hir_id.owner.to_def_id()) {
2828
if cx.tcx.impl_trait_ref(impl_did).is_some() {
2929
return;
3030
}

compiler/rustc_lint/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1904,7 +1904,7 @@ impl InvalidAtomicOrdering {
19041904
if let ExprKind::MethodCall(method_path, _, args, _) = &expr.kind
19051905
&& recognized_names.contains(&method_path.ident.name)
19061906
&& let Some(m_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
1907-
&& let Some(impl_did) = cx.tcx.impl_of_method(m_def_id)
1907+
&& let Some(impl_did) = cx.tcx.impl_of_assoc(m_def_id)
19081908
&& let Some(adt) = cx.tcx.type_of(impl_did).instantiate_identity().ty_adt_def()
19091909
// skip extension traits, only lint functions from the standard library
19101910
&& cx.tcx.trait_id_of_impl(impl_did).is_none()

compiler/rustc_middle/src/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl EffectiveVisibilities {
182182
// don't check this condition for them.
183183
let is_impl = matches!(tcx.def_kind(def_id), DefKind::Impl { .. });
184184
let is_associated_item_in_trait_impl = tcx
185-
.impl_of_method(def_id.to_def_id())
185+
.impl_of_assoc(def_id.to_def_id())
186186
.and_then(|impl_id| tcx.trait_id_of_impl(impl_id))
187187
.is_some();
188188
if !is_impl && !is_associated_item_in_trait_impl {

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2002,7 +2002,7 @@ impl<'tcx> TyCtxt<'tcx> {
20022002

20032003
/// If the given `DefId` describes a method belonging to an impl, returns the
20042004
/// `DefId` of the impl that the method belongs to; otherwise, returns `None`.
2005-
pub fn impl_of_method(self, def_id: DefId) -> Option<DefId> {
2005+
pub fn impl_of_assoc(self, def_id: DefId) -> Option<DefId> {
20062006
self.assoc_parent(def_id).filter(|id| matches!(self.def_kind(id), DefKind::Impl { .. }))
20072007
}
20082008

0 commit comments

Comments
 (0)