Skip to content

Commit 5a3ec37

Browse files
committed
add size assertions for some core types
1 parent 35aeba7 commit 5a3ec37

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/machine.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ use rand::SeedableRng;
1212

1313
use rustc_ast::ast::Mutability;
1414
use rustc_data_structures::fx::FxHashMap;
15+
#[allow(unused)]
16+
use rustc_data_structures::static_assert_size;
1517
use rustc_middle::{
1618
mir,
1719
ty::{
@@ -128,6 +130,13 @@ pub struct Tag {
128130
pub sb: SbTag,
129131
}
130132

133+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
134+
static_assert_size!(Pointer<Tag>, 24);
135+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
136+
static_assert_size!(Pointer<Option<Tag>>, 24);
137+
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
138+
static_assert_size!(ScalarMaybeUninit<Tag>, 32);
139+
131140
impl Provenance for Tag {
132141
/// We use absolute addresses in the `offset` of a `Pointer<Tag>`.
133142
const OFFSET_IS_ADDR: bool = true;

0 commit comments

Comments
 (0)