diff options
Diffstat (limited to 'tests/ui/consts/const-eval/ub-write-through-immutable.rs')
| -rw-r--r-- | tests/ui/consts/const-eval/ub-write-through-immutable.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/ui/consts/const-eval/ub-write-through-immutable.rs b/tests/ui/consts/const-eval/ub-write-through-immutable.rs index 945367f1823..9860b8fde4a 100644 --- a/tests/ui/consts/const-eval/ub-write-through-immutable.rs +++ b/tests/ui/consts/const-eval/ub-write-through-immutable.rs @@ -1,6 +1,5 @@ //! Ensure we catch UB due to writing through a shared reference. #![feature(const_mut_refs, const_refs_to_cell)] -#![deny(writes_through_immutable_pointer)] #![allow(invalid_reference_casting)] use std::mem; @@ -9,15 +8,15 @@ use std::cell::UnsafeCell; const WRITE_AFTER_CAST: () = unsafe { let mut x = 0; let ptr = &x as *const i32 as *mut i32; - *ptr = 0; //~ERROR: writes_through_immutable_pointer - //~^ previously accepted + *ptr = 0; //~ERROR: evaluation of constant value failed + //~| immutable }; const WRITE_AFTER_TRANSMUTE: () = unsafe { let mut x = 0; let ptr: *mut i32 = mem::transmute(&x); - *ptr = 0; //~ERROR: writes_through_immutable_pointer - //~^ previously accepted + *ptr = 0; //~ERROR: evaluation of constant value failed + //~| immutable }; // it's okay when there is interior mutability; |
