fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.2 KiB33 linesraw
1warning: changes to closure capture in Rust 2021 will affect drop order
2  --> $DIR/closure-body-macro-fragment.rs:16:17
3   |
4LL |           let f = || $body;
5   |                   ^^
6...
7LL |       }};
8   |       - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure
9...
10LL | /     m!({
11LL | |
12LL | |         let x = a.0;
13   | |                 --- in Rust 2018, this closure captures all of `a`, but in Rust 2021, it will only capture `a.0`
14LL | |         println!("{:?}", x);
15LL | |     });
16   | |______- in this macro invocation
17   |
18   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
19note: the lint level is defined here
20  --> $DIR/closure-body-macro-fragment.rs:4:9
21   |
22LL | #![warn(rust_2021_compatibility)]
23   |         ^^^^^^^^^^^^^^^^^^^^^^^
24   = note: `#[warn(rust_2021_incompatible_closure_captures)]` implied by `#[warn(rust_2021_compatibility)]`
25   = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
26help: add a dummy let to cause `a` to be fully captured
27   |
28LL ~     m!({
29LL +         let _ = &a;
30   |
31
32warning: 1 warning emitted
33