Skip to content

Commit af34d4d

Browse files
committed
Rename AssocItemContainer -> AssocContainer
1 parent c55b9cf commit af34d4d

File tree

27 files changed

+81
-83
lines changed

27 files changed

+81
-83
lines changed

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,8 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
10091009
res = res.and(check_associated_item(tcx, def_id));
10101010
let assoc_item = tcx.associated_item(def_id);
10111011
match assoc_item.container {
1012-
ty::AssocItemContainer::Impl => {}
1013-
ty::AssocItemContainer::Trait => {
1012+
ty::AssocContainer::Impl => {}
1013+
ty::AssocContainer::Trait => {
10141014
res = res.and(check_trait_item(tcx, def_id));
10151015
}
10161016
}
@@ -1026,8 +1026,8 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
10261026
res = res.and(check_associated_item(tcx, def_id));
10271027
let assoc_item = tcx.associated_item(def_id);
10281028
match assoc_item.container {
1029-
ty::AssocItemContainer::Impl => {}
1030-
ty::AssocItemContainer::Trait => {
1029+
ty::AssocContainer::Impl => {}
1030+
ty::AssocContainer::Trait => {
10311031
res = res.and(check_trait_item(tcx, def_id));
10321032
}
10331033
}
@@ -1043,8 +1043,8 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(),
10431043

10441044
let assoc_item = tcx.associated_item(def_id);
10451045
let has_type = match assoc_item.container {
1046-
ty::AssocItemContainer::Impl => true,
1047-
ty::AssocItemContainer::Trait => {
1046+
ty::AssocContainer::Impl => true,
1047+
ty::AssocContainer::Trait => {
10481048
tcx.ensure_ok().explicit_item_bounds(def_id);
10491049
tcx.ensure_ok().explicit_item_self_bounds(def_id);
10501050
if tcx.is_conditionally_const(def_id) {

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,8 +1449,8 @@ fn compare_self_type<'tcx>(
14491449

14501450
let self_string = |method: ty::AssocItem| {
14511451
let untransformed_self_ty = match method.container {
1452-
ty::AssocItemContainer::Impl => impl_trait_ref.self_ty(),
1453-
ty::AssocItemContainer::Trait => tcx.types.self_param,
1452+
ty::AssocContainer::Impl => impl_trait_ref.self_ty(),
1453+
ty::AssocContainer::Trait => tcx.types.self_param,
14541454
};
14551455
let self_arg_ty = tcx.fn_sig(method.def_id).instantiate_identity().input(0);
14561456
let (infcx, param_env) = tcx
@@ -2458,8 +2458,8 @@ fn param_env_with_gat_bounds<'tcx>(
24582458

24592459
for impl_ty in impl_tys_to_install {
24602460
let trait_ty = match impl_ty.container {
2461-
ty::AssocItemContainer::Trait => impl_ty,
2462-
ty::AssocItemContainer::Impl => tcx.associated_item(impl_ty.trait_item_def_id.unwrap()),
2461+
ty::AssocContainer::Trait => impl_ty,
2462+
ty::AssocContainer::Impl => tcx.associated_item(impl_ty.trait_item_def_id.unwrap()),
24632463
};
24642464

24652465
let mut bound_vars: smallvec::SmallVec<[ty::BoundVariableKind; 8]> =

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -948,10 +948,8 @@ pub(crate) fn check_associated_item(
948948
.coherent_trait(tcx.parent(item.trait_item_def_id.unwrap_or(item_id.into())))?;
949949

950950
let self_ty = match item.container {
951-
ty::AssocItemContainer::Trait => tcx.types.self_param,
952-
ty::AssocItemContainer::Impl => {
953-
tcx.type_of(item.container_id(tcx)).instantiate_identity()
954-
}
951+
ty::AssocContainer::Trait => tcx.types.self_param,
952+
ty::AssocContainer::Impl => tcx.type_of(item.container_id(tcx)).instantiate_identity(),
955953
};
956954

957955
let span = tcx.def_span(item_id);
@@ -978,7 +976,7 @@ pub(crate) fn check_associated_item(
978976
check_method_receiver(wfcx, hir_sig, item, self_ty)
979977
}
980978
ty::AssocKind::Type { .. } => {
981-
if let ty::AssocItemContainer::Trait = item.container {
979+
if let ty::AssocContainer::Trait = item.container {
982980
check_associated_type_bounds(wfcx, item, span)
983981
}
984982
if item.defaultness(tcx).has_value() {

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10211021
let container_id = assoc_item.container_id(tcx);
10221022
debug!(?def_id, ?container, ?container_id);
10231023
match container {
1024-
ty::AssocItemContainer::Trait => {
1024+
ty::AssocContainer::Trait => {
10251025
if let Err(e) = callee::check_legal_trait_for_method_call(
10261026
tcx,
10271027
path_span,
@@ -1033,7 +1033,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10331033
self.set_tainted_by_errors(e);
10341034
}
10351035
}
1036-
ty::AssocItemContainer::Impl => {
1036+
ty::AssocContainer::Impl => {
10371037
if segments.len() == 1 {
10381038
// `<T>::assoc` will end up here, and so
10391039
// can `T::assoc`. If this came from an

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18161816
if segment.ident.name == sym::clone
18171817
&& results.type_dependent_def_id(expr.hir_id).is_some_and(|did| {
18181818
let assoc_item = self.tcx.associated_item(did);
1819-
assoc_item.container == ty::AssocItemContainer::Trait
1819+
assoc_item.container == ty::AssocContainer::Trait
18201820
&& assoc_item.container_id(self.tcx) == clone_trait_did
18211821
})
18221822
// If that clone call hasn't already dereferenced the self type (i.e. don't give this

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ fn infer_type_if_missing<'tcx>(fcx: &FnCtxt<'_, 'tcx>, node: Node<'tcx>) -> Opti
290290
{
291291
if let Some(item) = tcx.opt_associated_item(def_id.into())
292292
&& let ty::AssocKind::Const { .. } = item.kind
293-
&& let ty::AssocItemContainer::Impl = item.container
293+
&& let ty::AssocContainer::Impl = item.container
294294
&& let Some(trait_item_def_id) = item.trait_item_def_id
295295
{
296296
let impl_def_id = item.container_id(tcx);

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use rustc_middle::middle::stability;
1818
use rustc_middle::ty::elaborate::supertrait_def_ids;
1919
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams, simplify_type};
2020
use rustc_middle::ty::{
21-
self, AssocItem, AssocItemContainer, GenericArgs, GenericArgsRef, GenericParamDefKind,
22-
ParamEnvAnd, Ty, TyCtxt, TypeVisitableExt, Upcast,
21+
self, AssocContainer, AssocItem, GenericArgs, GenericArgsRef, GenericParamDefKind, ParamEnvAnd,
22+
Ty, TyCtxt, TypeVisitableExt, Upcast,
2323
};
2424
use rustc_middle::{bug, span_bug};
2525
use rustc_session::lint;
@@ -530,7 +530,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
530530
ProbeScope::Single(def_id) => {
531531
let item = self.tcx.associated_item(def_id);
532532
// FIXME(fn_delegation): Delegation to inherent methods is not yet supported.
533-
assert_eq!(item.container, AssocItemContainer::Trait);
533+
assert_eq!(item.container, AssocContainer::Trait);
534534

535535
let trait_def_id = self.tcx.parent(def_id);
536536
let trait_span = self.tcx.def_span(trait_def_id);
@@ -1715,7 +1715,7 @@ impl<'tcx> Pick<'tcx> {
17151715
tcx.def_path_str(self.item.def_id),
17161716
));
17171717
}
1718-
(ty::AssocKind::Const { name }, ty::AssocItemContainer::Trait) => {
1718+
(ty::AssocKind::Const { name }, ty::AssocContainer::Trait) => {
17191719
let def_id = self.item.container_id(tcx);
17201720
lint.span_suggestion(
17211721
span,

compiler/rustc_lint/src/nonstandard_style.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ pub(crate) enum MethodLateContext {
3030
pub(crate) fn method_context(cx: &LateContext<'_>, id: LocalDefId) -> MethodLateContext {
3131
let item = cx.tcx.associated_item(id);
3232
match item.container {
33-
ty::AssocItemContainer::Trait => MethodLateContext::TraitAutoImpl,
34-
ty::AssocItemContainer::Impl => match cx.tcx.impl_trait_ref(item.container_id(cx.tcx)) {
33+
ty::AssocContainer::Trait => MethodLateContext::TraitAutoImpl,
34+
ty::AssocContainer::Impl => match cx.tcx.impl_trait_ref(item.container_id(cx.tcx)) {
3535
Some(_) => MethodLateContext::TraitImpl,
3636
None => MethodLateContext::PlainImpl,
3737
},

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc_middle::middle::dependency_format::Linkage;
2222
use rustc_middle::mir::interpret;
2323
use rustc_middle::query::Providers;
2424
use rustc_middle::traits::specialization_graph;
25-
use rustc_middle::ty::AssocItemContainer;
25+
use rustc_middle::ty::AssocContainer;
2626
use rustc_middle::ty::codec::TyEncoder;
2727
use rustc_middle::ty::fast_reject::{self, TreatParams};
2828
use rustc_middle::{bug, span_bug};
@@ -1254,8 +1254,8 @@ fn should_encode_type(tcx: TyCtxt<'_>, def_id: LocalDefId, def_kind: DefKind) ->
12541254
DefKind::AssocTy => {
12551255
let assoc_item = tcx.associated_item(def_id);
12561256
match assoc_item.container {
1257-
ty::AssocItemContainer::Impl => true,
1258-
ty::AssocItemContainer::Trait => assoc_item.defaultness(tcx).has_value(),
1257+
ty::AssocContainer::Impl => true,
1258+
ty::AssocContainer::Trait => assoc_item.defaultness(tcx).has_value(),
12591259
}
12601260
}
12611261
DefKind::TyParam => {
@@ -1729,7 +1729,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
17291729
self.tables.assoc_container.set_some(def_id.index, item.container);
17301730

17311731
match item.container {
1732-
AssocItemContainer::Trait => {
1732+
AssocContainer::Trait => {
17331733
if item.is_type() {
17341734
self.encode_explicit_item_bounds(def_id);
17351735
self.encode_explicit_item_self_bounds(def_id);
@@ -1739,7 +1739,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
17391739
}
17401740
}
17411741
}
1742-
AssocItemContainer::Impl => {
1742+
AssocContainer::Impl => {
17431743
if let Some(trait_item_def_id) = item.trait_item_def_id {
17441744
self.tables.trait_item_def_id.set_some(def_id.index, trait_item_def_id.into());
17451745
}

compiler/rustc_metadata/src/rmeta/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ define_tables! {
459459
def_keys: Table<DefIndex, LazyValue<DefKey>>,
460460
proc_macro_quoted_spans: Table<usize, LazyValue<Span>>,
461461
variant_data: Table<DefIndex, LazyValue<VariantData>>,
462-
assoc_container: Table<DefIndex, ty::AssocItemContainer>,
462+
assoc_container: Table<DefIndex, ty::AssocContainer>,
463463
macro_definition: Table<DefIndex, LazyValue<ast::DelimArgs>>,
464464
proc_macro: Table<DefIndex, MacroKind>,
465465
deduced_param_attrs: Table<DefIndex, LazyArray<DeducedParamAttrs>>,

0 commit comments

Comments
 (0)