]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/consts/const-eval/ub-wide-ptr.rs
Rollup merge of #95530 - notriddle:notriddle/private-kw-prim, r=jsha
[rust.git] / src / test / ui / consts / const-eval / ub-wide-ptr.rs
index 0fb9f7960ce1a4871f5b911d68c929203634e9f0..ea48a095df95c53ab7f61a134147c80c63aa7ee9 100644 (file)
@@ -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