Skip to content

Commit 0a4d63a

Browse files
committed
Split AssocContainer::{InherentImpl,TraitImpl}
1 parent 1d64c7e commit 0a4d63a

File tree

2 files changed

+12
-8
lines changed
  • compiler/rustc_public/src

2 files changed

+12
-8
lines changed

compiler/rustc_public/src/ty.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,10 +1613,6 @@ pub struct AssocItem {
16131613
pub def_id: AssocDef,
16141614
pub kind: AssocKind,
16151615
pub container: AssocContainer,
1616-
1617-
/// If this is an item in an impl of a trait then this is the `DefId` of
1618-
/// the associated item on the trait that this implements.
1619-
pub trait_item_def_id: Option<AssocDef>,
16201616
}
16211617

16221618
#[derive(Clone, PartialEq, Debug, Eq, Serialize)]
@@ -1637,8 +1633,10 @@ pub enum AssocKind {
16371633

16381634
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
16391635
pub enum AssocContainer {
1636+
InherentImpl,
1637+
/// The `AssocDef` points to the trait item being implemented.
1638+
TraitImpl(AssocDef),
16401639
Trait,
1641-
Impl,
16421640
}
16431641

16441642
#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, Serialize)]

compiler/rustc_public/src/unstable/convert/stable/ty.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,11 +1079,18 @@ impl<'tcx> Stable<'tcx> for ty::AssocKind {
10791079
impl<'tcx> Stable<'tcx> for ty::AssocContainer {
10801080
type T = crate::ty::AssocContainer;
10811081

1082-
fn stable(&self, _: &mut Tables<'_, BridgeTys>, _: &CompilerCtxt<'_, BridgeTys>) -> Self::T {
1082+
fn stable(
1083+
&self,
1084+
tables: &mut Tables<'_, BridgeTys>,
1085+
_: &CompilerCtxt<'_, BridgeTys>,
1086+
) -> Self::T {
10831087
use crate::ty::AssocContainer;
10841088
match self {
10851089
ty::AssocContainer::Trait => AssocContainer::Trait,
1086-
ty::AssocContainer::Impl => AssocContainer::Impl,
1090+
ty::AssocContainer::InherentImpl => AssocContainer::InherentImpl,
1091+
ty::AssocContainer::TraitImpl(trait_item_id) => {
1092+
AssocContainer::TraitImpl(tables.assoc_def(trait_item_id.unwrap()))
1093+
}
10871094
}
10881095
}
10891096
}
@@ -1100,7 +1107,6 @@ impl<'tcx> Stable<'tcx> for ty::AssocItem {
11001107
def_id: tables.assoc_def(self.def_id),
11011108
kind: self.kind.stable(tables, cx),
11021109
container: self.container.stable(tables, cx),
1103-
trait_item_def_id: self.trait_item_def_id.map(|did| tables.assoc_def(did)),
11041110
}
11051111
}
11061112
}

0 commit comments

Comments
 (0)