add size assertions for some core types

This commit is contained in:
Ralf Jung 2022-04-17 21:46:42 -04:00
parent 35aeba78db
commit 5a3ec3780e

View file

@ -12,6 +12,8 @@ use rand::SeedableRng;
use rustc_ast::ast::Mutability;
use rustc_data_structures::fx::FxHashMap;
#[allow(unused)]
use rustc_data_structures::static_assert_size;
use rustc_middle::{
mir,
ty::{
@ -128,6 +130,13 @@ pub struct Tag {
pub sb: SbTag,
}
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(Pointer<Tag>, 24);
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(Pointer<Option<Tag>>, 24);
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(ScalarMaybeUninit<Tag>, 32);
impl Provenance for Tag {
/// We use absolute addresses in the `offset` of a `Pointer<Tag>`.
const OFFSET_IS_ADDR: bool = true;