fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
785 B15 linesraw
1error[E0080]: it is undefined behavior to use this value
2  --> $DIR/ub-upvars.rs:6:1
3   |
4LL | / const BAD_UPVAR: &dyn FnOnce() = &{
5LL | |     let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) };
6LL | |     let another_var = 13;
7LL | |     move || { let _ = bad_ref; let _ = another_var; }
8LL | | };
9   | |__^ type validation failed: encountered 0 at .<deref>.<dyn-downcast>.<closure-var(bad_ref)>, but expected something greater or equal to 1
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
13error: aborting due to previous error
14
15For more information about this error, try `rustc --explain E0080`.