]> git.lizzy.rs Git - rust.git/blob - tests/ui/unsafe/ranged_ints2.rs
Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr
[rust.git] / tests / ui / unsafe / ranged_ints2.rs
1 // revisions: mirunsafeck thirunsafeck
2 // [thirunsafeck]compile-flags: -Z thir-unsafeck
3
4 #![feature(rustc_attrs)]
5
6 #[rustc_layout_scalar_valid_range_start(1)]
7 #[repr(transparent)]
8 pub(crate) struct NonZero<T>(pub(crate) T);
9 fn main() {
10     let mut x = unsafe { NonZero(1) };
11     let y = &mut x.0; //~ ERROR mutation of layout constrained field is unsafe
12 }