rust/src/test/ui/consts/const-eval/ub-upvars.64bit.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
1020 B
Plaintext
Raw Normal View History

2018-10-01 05:52:47 -05:00
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-upvars.rs:6:1
|
2019-05-28 13:46:13 -05:00
LL | / const BAD_UPVAR: &dyn FnOnce() = &{
LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
LL | | let another_var = 13;
LL | | move || { let _ = bad_ref; let _ = another_var; }
LL | | };
| |__^ constructing invalid value at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>: encountered a null reference
|
= 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.
= note: the raw bytes of the constant (size: 16, align: 8) {
2021-07-12 17:21:35 -05:00
╾───────alloc3────────╼ ╾───────alloc6────────╼ │ ╾──────╼╾──────╼
}
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.