We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf57409 commit e7fed14Copy full SHA for e7fed14
src/test/ui/consts/const-eval/ub-ref.rs
@@ -11,6 +11,9 @@ const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
11
const NULL: &u16 = unsafe { mem::transmute(0usize) };
12
//~^ ERROR it is undefined behavior to use this value
13
14
+// It is very important that we reject this: We do promote `&(4 * REF_AS_USIZE)`,
15
+// but that would fail to compile; so we ended up breaking user code that would
16
+// have worked fine had we not promoted.
17
const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
18
19
0 commit comments