19 lines
1016 B
Plaintext
19 lines
1016 B
Plaintext
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/ub-upvars.rs:5:1
|
|
|
|
|
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 | | };
|
|
| |__^ type validation failed: encountered a NULL reference at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>
|
|
|
|
|
= 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) {
|
|
╾───────alloc2────────╼ ╾───────alloc3────────╼ │ ╾──────╼╾──────╼
|
|
}
|
|
|
|
error: aborting due to previous error
|
|
|
|
For more information about this error, try `rustc --explain E0080`.
|