Auto merge of #110243 - WaffleLapkin:bless_tagged_pointers🙏, r=Nilstrieb

Tagged pointers, now with strict provenance!

This is a big refactor of tagged pointers in rustc, with three main goals:
1. Porting the code to the strict provenance
2. Cleanup the code
3. Document the code (and safety invariants) better

This PR has grown quite a bit (almost a complete rewrite at this point...), so I'm not sure what's the best way to review this, but reviewing commit-by-commit should be fine.

r? `@Nilstrieb`
This commit is contained in:
bors
2023-04-17 21:50:13 +00:00
10 changed files with 665 additions and 241 deletions

View File

@@ -1627,7 +1627,8 @@ struct ParamTag {
}
unsafe impl rustc_data_structures::tagged_ptr::Tag for ParamTag {
const BITS: usize = 2;
const BITS: u32 = 2;
#[inline]
fn into_usize(self) -> usize {
match self {
@@ -1637,6 +1638,7 @@ unsafe impl rustc_data_structures::tagged_ptr::Tag for ParamTag {
Self { reveal: traits::Reveal::All, constness: hir::Constness::Const } => 3,
}
}
#[inline]
unsafe fn from_usize(ptr: usize) -> Self {
match ptr {