2020-04-18 02:15:59 -05:00
|
|
|
// gets masked by optimizations
|
2022-07-08 11:08:32 -05:00
|
|
|
//@compile-flags: -Zmir-opt-level=0
|
2018-11-03 06:07:16 -05:00
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
#![allow(unused_attributes)]
|
|
|
|
|
|
|
|
#[rustc_layout_scalar_valid_range_start(1)]
|
|
|
|
#[repr(transparent)]
|
|
|
|
pub(crate) struct NonZero<T>(pub(crate) T);
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Make sure that we detect this even when no function call is happening along the way
|
2022-07-11 06:44:55 -05:00
|
|
|
let _x = Some(unsafe { NonZero(0) }); //~ ERROR: encountered 0, but expected something greater or equal to 1
|
2018-11-03 06:07:16 -05:00
|
|
|
}
|