]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/ub-upvars.32bit.stderr
0818d7fbf88bc6c80412bc7b39cb9fb716b2ecb5
[rust.git] / src / test / ui / consts / const-eval / ub-upvars.32bit.stderr
1 error[E0080]: it is undefined behavior to use this value
2   --> $DIR/ub-upvars.rs:6:1
3    |
4 LL | / const BAD_UPVAR: &dyn FnOnce() = &{
5 LL | |     let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
6 LL | |     let another_var = 13;
7 LL | |     move || { let _ = bad_ref; let _ = another_var; }
8 LL | | };
9    | |__^ type validation failed at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>: encountered a null reference
10    |
11    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
12    = note: the raw bytes of the constant (size: 8, align: 4) {
13                ╾─alloc2──╼ ╾─alloc5──╼                         │ ╾──╼╾──╼
14            }
15
16 error: aborting due to previous error
17
18 For more information about this error, try `rustc --explain E0080`.