Skip to content

Commit

Permalink
Auto merge of #2070 - RalfJung:size-assert, r=RalfJung
Browse files Browse the repository at this point in the history
add size assertions for some core types
  • Loading branch information
bors committed Apr 18, 2022
2 parents 35aeba7 + 5a3ec37 commit 9d47a56
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9d47a56

Please sign in to comment.