X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftest%2Fui%2Fconsts%2Fconst-eval%2Fub-wide-ptr.rs;h=ea48a095df95c53ab7f61a134147c80c63aa7ee9;hb=c6750e491c683aa208f908c496a675dc2eceb005;hp=0fb9f7960ce1a4871f5b911d68c929203634e9f0;hpb=e1d49aaad4fde33469fdb786c29838a95a5d8a11;p=rust.git diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/src/test/ui/consts/const-eval/ub-wide-ptr.rs index 0fb9f7960ce..ea48a095df9 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.rs @@ -67,6 +67,9 @@ impl Trait for bool {} // bad slice: length too big const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) }; //~^ ERROR it is undefined behavior to use this value +// bad slice: length computation overflows +const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) }; +//~^ ERROR it is undefined behavior to use this value // bad slice: length not an int const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) }; //~^ ERROR it is undefined behavior to use this value