2020-06-20 19:59:04 -05:00
|
|
|
// build-pass
|
2021-05-15 08:26:28 -05:00
|
|
|
// revisions: mir thir
|
|
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
|
2020-06-20 19:59:04 -05:00
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
|
|
|
macro_rules! apply {
|
|
|
|
($val:expr) => {
|
|
|
|
#[rustc_layout_scalar_valid_range_start($val)]
|
|
|
|
#[repr(transparent)]
|
|
|
|
pub(crate) struct NonZero<T>(pub(crate) T);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
apply!(1);
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _x = unsafe { NonZero(1) };
|
|
|
|
}
|