diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2025-08-13 15:24:19 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2025-09-12 15:14:15 -0500 |
| commit | 9615ec7d108399501d7d48f4aeac46561ef31fc8 (patch) | |
| tree | a06cb4dbb6550440a2aacf3f4d7d89e618172e5c /compiler/rustc_public | |
| parent | 88a8bfcaf0398011b621a981483c288d1e3b64e2 (diff) | |
| download | rust-9615ec7d108399501d7d48f4aeac46561ef31fc8.tar.gz rust-9615ec7d108399501d7d48f4aeac46561ef31fc8.zip | |
Split AssocContainer::{InherentImpl,TraitImpl}
Diffstat (limited to 'compiler/rustc_public')
| -rw-r--r-- | compiler/rustc_public/src/ty.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_public/src/unstable/convert/stable/ty.rs | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/compiler/rustc_public/src/ty.rs b/compiler/rustc_public/src/ty.rs index c7422051c36..bcc77ff849d 100644 --- a/compiler/rustc_public/src/ty.rs +++ b/compiler/rustc_public/src/ty.rs @@ -1613,10 +1613,6 @@ pub struct AssocItem { pub def_id: AssocDef, pub kind: AssocKind, pub container: AssocContainer, - - /// If this is an item in an impl of a trait then this is the `DefId` of - /// the associated item on the trait that this implements. - pub trait_item_def_id: Option<AssocDef>, } #[derive(Clone, PartialEq, Debug, Eq, Serialize)] @@ -1637,8 +1633,10 @@ pub enum AssocKind { #[derive(Clone, Debug, Eq, PartialEq, Serialize)] pub enum AssocContainer { + InherentImpl, + /// The `AssocDef` points to the trait item being implemented. + TraitImpl(AssocDef), Trait, - Impl, } #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, Serialize)] diff --git a/compiler/rustc_public/src/unstable/convert/stable/ty.rs b/compiler/rustc_public/src/unstable/convert/stable/ty.rs index ace459e79da..5131611eb02 100644 --- a/compiler/rustc_public/src/unstable/convert/stable/ty.rs +++ b/compiler/rustc_public/src/unstable/convert/stable/ty.rs @@ -1079,11 +1079,18 @@ impl<'tcx> Stable<'tcx> for ty::AssocKind { impl<'tcx> Stable<'tcx> for ty::AssocContainer { type T = crate::ty::AssocContainer; - fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T { + fn stable( + &self, + tables: &mut Tables<'_, BridgeTys>, + _: &CompilerCtxt<'_, BridgeTys>, + ) -> Self::T { use crate::ty::AssocContainer; match self { ty::AssocContainer::Trait => AssocContainer::Trait, - ty::AssocContainer::Impl => AssocContainer::Impl, + ty::AssocContainer::InherentImpl => AssocContainer::InherentImpl, + ty::AssocContainer::TraitImpl(trait_item_id) => { + AssocContainer::TraitImpl(tables.assoc_def(trait_item_id.unwrap())) + } } } } @@ -1100,7 +1107,6 @@ impl<'tcx> Stable<'tcx> for ty::AssocItem { def_id: tables.assoc_def(self.def_id), kind: self.kind.stable(tables, cx), container: self.container.stable(tables, cx), - trait_item_def_id: self.trait_item_def_id.map(|did| tables.assoc_def(did)), } } } |
