mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
20 lines
354 B
Rust
20 lines
354 B
Rust
// build-pass
|
|
// revisions: mir thir
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
#![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) };
|
|
}
|