diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 0d671ec653b..fd33eea7902 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -27,12 +27,27 @@ pub type AllocExtra = Stacks; /// Tracking pointer provenance -#[derive(Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Copy, Clone, Hash, Eq)] pub enum SbTag { Tagged(PtrId), Untagged, } +impl SbTag { + fn as_u64(self) -> u64 { + match self { + SbTag::Tagged(id) => id.get(), + SbTag::Untagged => 0, + } + } +} + +impl PartialEq for SbTag { + fn eq(&self, other: &Self) -> bool { + self.as_u64() == other.as_u64() + } +} + impl fmt::Debug for SbTag { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self {