]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
[rust.git] / tests / ui / closures / 2229_closure_analysis / migrations / auto_traits.stderr
1 error: changes to closure capture in Rust 2021 will affect which traits the closure implements
2   --> $DIR/auto_traits.rs:22:19
3    |
4 LL |     thread::spawn(move || unsafe {
5    |                   ^^^^^^^ in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr` is not fully captured and `fptr.0` does not implement `Send`
6 ...
7 LL |         *fptr.0 = 20;
8    |         ------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
9    |
10    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
11 note: the lint level is defined here
12   --> $DIR/auto_traits.rs:2:9
13    |
14 LL | #![deny(rust_2021_incompatible_closure_captures)]
15    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 help: add a dummy let to cause `fptr` to be fully captured
17    |
18 LL ~     thread::spawn(move || { let _ = &fptr; unsafe {
19 LL |
20  ...
21 LL |
22 LL ~     } });
23    |
24
25 error: changes to closure capture in Rust 2021 will affect which traits the closure implements
26   --> $DIR/auto_traits.rs:42:19
27    |
28 LL |     thread::spawn(move || unsafe {
29    |                   ^^^^^^^
30    |                   |
31    |                   in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr` is not fully captured and `fptr.0.0` does not implement `Send`
32    |                   in Rust 2018, this closure implements `Sync` as `fptr` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` because `fptr` is not fully captured and `fptr.0.0` does not implement `Sync`
33 ...
34 LL |         *fptr.0.0 = 20;
35    |         --------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
36    |
37    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
38 help: add a dummy let to cause `fptr` to be fully captured
39    |
40 LL ~     thread::spawn(move || { let _ = &fptr; unsafe {
41 LL |
42  ...
43 LL |
44 LL ~     } });
45    |
46
47 error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
48   --> $DIR/auto_traits.rs:67:13
49    |
50 LL |     let c = || {
51    |             ^^ in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` because `f` is not fully captured and `f.1` does not implement `Clone`
52 ...
53 LL |         let f_1 = f.1;
54    |                   --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.1`
55 ...
56 LL | }
57    | - in Rust 2018, `f` is dropped here, but in Rust 2021, only `f.1` will be dropped here as part of the closure
58    |
59    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
60 help: add a dummy let to cause `f` to be fully captured
61    |
62 LL ~     let c = || {
63 LL +         let _ = &f;
64    |
65
66 error: aborting due to 3 previous errors
67