diff options
Diffstat (limited to 'src/test/ui/consts/const-eval/ub-ref-ptr.rs')
| -rw-r--r-- | src/test/ui/consts/const-eval/ub-ref-ptr.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/src/test/ui/consts/const-eval/ub-ref-ptr.rs index 1887cb24bf4..17b0d29c514 100644 --- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs +++ b/src/test/ui/consts/const-eval/ub-ref-ptr.rs @@ -1,6 +1,6 @@ // ignore-tidy-linelength // stderr-per-bitwidth -#![allow(const_err, invalid_value)] // make sure we cannot allow away the errors tested here +#![allow(invalid_value)] use std::mem; @@ -29,13 +29,20 @@ const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) }; // but that would fail to compile; so we ended up breaking user code that would // have worked fine had we not promoted. const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR any use of this value will cause an error +//~| WARN this was previously accepted by the compiler but is being phased out const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR any use of this value will cause an error +//~| WARN this was previously accepted by the compiler but is being phased out +//~| ERROR any use of this value will cause an error +//~| WARN this was previously accepted by the compiler but is being phased out const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; -//~^ ERROR it is undefined behavior to use this value +//~^ ERROR any use of this value will cause an error +//~| WARN this was previously accepted by the compiler but is being phased out +//~| ERROR any use of this value will cause an error +//~| WARN this was previously accepted by the compiler but is being phased out const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; //~^ ERROR it is undefined behavior to use this value |
