Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit be4b026

Browse files
ty::KContainer -> ty::AssocItemContainer::K
1 parent 8e6af16 commit be4b026

File tree

21 files changed

+59
-61
lines changed

21 files changed

+59
-61
lines changed

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ pub fn check_tied_features(
710710
/// applied to the method prototype.
711711
fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
712712
if let Some(impl_item) = tcx.opt_associated_item(def_id)
713-
&& let ty::AssocItemContainer::ImplContainer = impl_item.container
713+
&& let ty::AssocItemContainer::Impl = impl_item.container
714714
&& let Some(trait_item) = impl_item.trait_item_def_id
715715
{
716716
return tcx.codegen_fn_attrs(trait_item).flags.intersects(CodegenFnAttrFlags::TRACK_CALLER);

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

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

11901190
let self_string = |method: ty::AssocItem| {
11911191
let untransformed_self_ty = match method.container {
1192-
ty::ImplContainer => impl_trait_ref.self_ty(),
1193-
ty::TraitContainer => tcx.types.self_param,
1192+
ty::AssocItemContainer::Impl => impl_trait_ref.self_ty(),
1193+
ty::AssocItemContainer::Trait => tcx.types.self_param,
11941194
};
11951195
let self_arg_ty = tcx.fn_sig(method.def_id).instantiate_identity().input(0);
11961196
let param_env = ty::ParamEnv::reveal_all();
@@ -2224,10 +2224,8 @@ fn param_env_with_gat_bounds<'tcx>(
22242224

22252225
for impl_ty in impl_tys_to_install {
22262226
let trait_ty = match impl_ty.container {
2227-
ty::AssocItemContainer::TraitContainer => impl_ty,
2228-
ty::AssocItemContainer::ImplContainer => {
2229-
tcx.associated_item(impl_ty.trait_item_def_id.unwrap())
2230-
}
2227+
ty::AssocItemContainer::Trait => impl_ty,
2228+
ty::AssocItemContainer::Impl => tcx.associated_item(impl_ty.trait_item_def_id.unwrap()),
22312229
};
22322230

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

compiler/rustc_hir_analysis/src/check/wfcheck.rs

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

10501050
let self_ty = match item.container {
1051-
ty::TraitContainer => tcx.types.self_param,
1052-
ty::ImplContainer => tcx.type_of(item.container_id(tcx)).instantiate_identity(),
1051+
ty::AssocItemContainer::Trait => tcx.types.self_param,
1052+
ty::AssocItemContainer::Impl => {
1053+
tcx.type_of(item.container_id(tcx)).instantiate_identity()
1054+
}
10531055
};
10541056

10551057
match item.kind {
@@ -1072,7 +1074,7 @@ fn check_associated_item(
10721074
check_method_receiver(wfcx, hir_sig, item, self_ty)
10731075
}
10741076
ty::AssocKind::Type => {
1075-
if let ty::AssocItemContainer::TraitContainer = item.container {
1077+
if let ty::AssocItemContainer::Trait = item.container {
10761078
check_associated_type_bounds(wfcx, item, span)
10771079
}
10781080
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
@@ -1025,7 +1025,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10251025
let container_id = assoc_item.container_id(tcx);
10261026
debug!(?def_id, ?container, ?container_id);
10271027
match container {
1028-
ty::TraitContainer => {
1028+
ty::AssocItemContainer::Trait => {
10291029
if let Err(e) = callee::check_legal_trait_for_method_call(
10301030
tcx,
10311031
path_span,
@@ -1037,7 +1037,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10371037
self.set_tainted_by_errors(e);
10381038
}
10391039
}
1040-
ty::ImplContainer => {
1040+
ty::AssocItemContainer::Impl => {
10411041
if segments.len() == 1 {
10421042
// `<T>::assoc` will end up here, and so
10431043
// 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
@@ -1796,7 +1796,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17961796
false,
17971797
|did| {
17981798
let assoc_item = self.tcx.associated_item(did);
1799-
assoc_item.container == ty::AssocItemContainer::TraitContainer
1799+
assoc_item.container == ty::AssocItemContainer::Trait
18001800
&& assoc_item.container_id(self.tcx) == clone_trait_did
18011801
},
18021802
)

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn infer_type_if_missing<'tcx>(fcx: &FnCtxt<'_, 'tcx>, node: Node<'tcx>) -> Opti
239239
let expected_type = if let Some(&hir::Ty { kind: hir::TyKind::Infer, span, .. }) = node.ty() {
240240
if let Some(item) = tcx.opt_associated_item(def_id.into())
241241
&& let ty::AssocKind::Const = item.kind
242-
&& let ty::ImplContainer = item.container
242+
&& let ty::AssocItemContainer::Impl = item.container
243243
&& let Some(trait_item_def_id) = item.trait_item_def_id
244244
{
245245
let impl_def_id = item.container_id(tcx);

compiler/rustc_hir_typeck/src/method/probe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
480480
ProbeScope::Single(def_id) => {
481481
let item = self.tcx.associated_item(def_id);
482482
// FIXME(fn_delegation): Delegation to inherent methods is not yet supported.
483-
assert_eq!(item.container, AssocItemContainer::TraitContainer);
483+
assert_eq!(item.container, AssocItemContainer::Trait);
484484

485485
let trait_def_id = self.tcx.parent(def_id);
486486
let trait_span = self.tcx.def_span(trait_def_id);
@@ -1406,7 +1406,7 @@ impl<'tcx> Pick<'tcx> {
14061406
tcx.def_path_str(self.item.def_id),
14071407
));
14081408
}
1409-
(ty::AssocKind::Const, ty::AssocItemContainer::TraitContainer) => {
1409+
(ty::AssocKind::Const, ty::AssocItemContainer::Trait) => {
14101410
let def_id = self.item.container_id(tcx);
14111411
lint.span_suggestion(
14121412
span,

compiler/rustc_lint/src/nonstandard_style.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ pub(crate) enum MethodLateContext {
2626
pub(crate) fn method_context(cx: &LateContext<'_>, id: LocalDefId) -> MethodLateContext {
2727
let item = cx.tcx.associated_item(id);
2828
match item.container {
29-
ty::TraitContainer => MethodLateContext::TraitAutoImpl,
30-
ty::ImplContainer => match cx.tcx.impl_trait_ref(item.container_id(cx.tcx)) {
29+
ty::AssocItemContainer::Trait => MethodLateContext::TraitAutoImpl,
30+
ty::AssocItemContainer::Impl => match cx.tcx.impl_trait_ref(item.container_id(cx.tcx)) {
3131
Some(_) => MethodLateContext::TraitImpl,
3232
None => MethodLateContext::PlainImpl,
3333
},

compiler/rustc_metadata/src/rmeta/encoder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,8 +1203,8 @@ fn should_encode_type(tcx: TyCtxt<'_>, def_id: LocalDefId, def_kind: DefKind) ->
12031203
DefKind::AssocTy => {
12041204
let assoc_item = tcx.associated_item(def_id);
12051205
match assoc_item.container {
1206-
ty::AssocItemContainer::ImplContainer => true,
1207-
ty::AssocItemContainer::TraitContainer => assoc_item.defaultness(tcx).has_value(),
1206+
ty::AssocItemContainer::Impl => true,
1207+
ty::AssocItemContainer::Trait => assoc_item.defaultness(tcx).has_value(),
12081208
}
12091209
}
12101210
DefKind::TyParam => {
@@ -1336,7 +1336,7 @@ fn should_encode_const(def_kind: DefKind) -> bool {
13361336

13371337
fn should_encode_fn_impl_trait_in_trait<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
13381338
if let Some(assoc_item) = tcx.opt_associated_item(def_id)
1339-
&& assoc_item.container == ty::AssocItemContainer::TraitContainer
1339+
&& assoc_item.container == ty::AssocItemContainer::Trait
13401340
&& assoc_item.kind == ty::AssocKind::Fn
13411341
{
13421342
true
@@ -1649,7 +1649,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
16491649
self.tables.assoc_container.set_some(def_id.index, item.container);
16501650

16511651
match item.container {
1652-
AssocItemContainer::TraitContainer => {
1652+
AssocItemContainer::Trait => {
16531653
if let ty::AssocKind::Type = item.kind {
16541654
self.encode_explicit_item_bounds(def_id);
16551655
self.encode_explicit_item_super_predicates(def_id);
@@ -1659,7 +1659,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
16591659
}
16601660
}
16611661
}
1662-
AssocItemContainer::ImplContainer => {
1662+
AssocItemContainer::Impl => {
16631663
if let Some(trait_item_def_id) = item.trait_item_def_id {
16641664
self.tables.trait_item_def_id.set_some(def_id.index, trait_item_def_id.into());
16651665
}

compiler/rustc_metadata/src/rmeta/table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ fixed_size_enum! {
223223

224224
fixed_size_enum! {
225225
ty::AssocItemContainer {
226-
( TraitContainer )
227-
( ImplContainer )
226+
( Trait )
227+
( Impl )
228228
}
229229
}
230230

0 commit comments

Comments
 (0)