about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/static_align.rs
blob: f292f028568b6a91c67d2982b96c43ad1d6f3c24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![feature(static_align)]

// When a static uses `align(N)`, its address should be a multiple of `N`.

#[rustc_align_static(256)]
static FOO: u64 = 0;

#[rustc_align_static(512)]
static BAR: u64 = 0;

fn main() {
    assert!(core::ptr::from_ref(&FOO).addr().is_multiple_of(256));
    assert!(core::ptr::from_ref(&BAR).addr().is_multiple_of(512));
}