summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
blob: 856ec4a5b9eb3fa7007409608e3640b642c65152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
error: changes to closure capture in Rust 2021 will affect which traits the closure implements
  --> $DIR/auto_traits.rs:22:19
   |
LL |     thread::spawn(move || unsafe {
   |                   ^^^^^^^ 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`
...
LL |         *fptr.0 = 20;
   |         ------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
note: the lint level is defined here
  --> $DIR/auto_traits.rs:2:9
   |
LL | #![deny(rust_2021_incompatible_closure_captures)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: add a dummy let to cause `fptr` to be fully captured
   |
LL ~     thread::spawn(move || { let _ = &fptr; unsafe {
LL |
 ...
LL |
LL ~     } }).join().unwrap();
   |

error: changes to closure capture in Rust 2021 will affect which traits the closure implements
  --> $DIR/auto_traits.rs:42:19
   |
LL |     thread::spawn(move || unsafe {
   |                   ^^^^^^^
   |                   |
   |                   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`
   |                   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`
...
LL |         *fptr.0.0 = 20;
   |         --------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
help: add a dummy let to cause `fptr` to be fully captured
   |
LL ~     thread::spawn(move || { let _ = &fptr; unsafe {
LL |
 ...
LL |
LL ~     } }).join().unwrap();
   |

error: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
  --> $DIR/auto_traits.rs:67:13
   |
LL |     let c = || {
   |             ^^ 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`
...
LL |         let f_1 = f.1;
   |                   --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.1`
...
LL | }
   | - in Rust 2018, `f` is dropped here, but in Rust 2021, only `f.1` will be dropped here as part of the closure
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
help: add a dummy let to cause `f` to be fully captured
   |
LL ~     let c = || {
LL +         let _ = &f;
   |

error: aborting due to 3 previous errors