2018-10-01 05:52:47 -05:00
error[E0080]: it is undefined behavior to use this value
2018-12-25 09:56:47 -06:00
--> $DIR/ub-upvars.rs:6:1
2018-10-11 03:16:51 -05:00
|
2019-05-28 13:46:13 -05:00
LL | / const BAD_UPVAR: &dyn FnOnce() = &{
2018-10-11 03:16:51 -05:00
LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
LL | | let another_var = 13;
LL | | move || { let _ = bad_ref; let _ = another_var; }
LL | | };
2020-02-26 05:00:33 -06:00
| |__^ type validation failed: encountered a NULL reference at .<deref>.<dyn-downcast>.<captured-var(bad_ref)>
2018-10-11 03:16:51 -05:00
|
2019-09-01 12:09:59 -05:00
= 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.
2018-10-11 03:16:51 -05:00
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.