You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed
+7-7
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ fn test_send_trait() {
13
13
let fptr = SendPointer(&mut f as *mut i32);
14
14
thread::spawn(move || { let _ = &fptr; unsafe {
15
15
//~^ ERROR: `Send` trait implementation for closure
16
-
//~| NOTE: in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure would no longer implement `Send` as `fptr.0` does not implement `Send`
16
+
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
17
17
//~| NOTE: for more information, see
18
18
//~| HELP: add a dummy let to cause `fptr` to be fully captured
19
19
*fptr.0 = 20;
20
-
//~^ NOTE: in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0`
20
+
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
21
21
} });
22
22
}
23
23
@@ -33,11 +33,11 @@ fn test_sync_trait() {
33
33
let fptr = SyncPointer(f);
34
34
thread::spawn(move || { let _ = &fptr; unsafe {
35
35
//~^ ERROR: `Sync`, `Send` trait implementation for closure
36
-
//~| NOTE: in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure would no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
36
+
//~| NOTE: in Rust 2018, this closure implements `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
37
37
//~| NOTE: for more information, see
38
38
//~| HELP: add a dummy let to cause `fptr` to be fully captured
39
39
*fptr.0.0 = 20;
40
-
//~^ NOTE: in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0.0`
40
+
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
41
41
} });
42
42
}
43
43
@@ -57,19 +57,19 @@ fn test_clone_trait() {
57
57
let f = U(S(String::from("Hello World")), T(0));
58
58
let c = || { let _ = &f;
59
59
//~^ ERROR: `Clone` trait implementation for closure and drop order
60
-
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f.1` does not implement `Clone`
60
+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
61
61
//~| NOTE: for more information, see
62
62
//~| HELP: add a dummy let to cause `f` to be fully captured
63
63
let f_1 = f.1;
64
-
//~^ NOTE: in Rust 2018, closure captures all of `f`, but in Rust 2021, it only captures `f.1`
64
+
//~^ NOTE: in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.1`
65
65
println!("{:?}", f_1.0);
66
66
};
67
67
68
68
let c_clone = c.clone();
69
69
70
70
c_clone();
71
71
}
72
-
//~^ NOTE: in Rust 2018, `f` would be dropped here, but in Rust 2021, only `f.1` would be dropped here alongside the closure
72
+
//~^ NOTE: in Rust 2018, `f` is dropped here, but in Rust 2021, only `f.1` will be dropped here as part of the closure
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs
+7-7
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ fn test_send_trait() {
13
13
let fptr = SendPointer(&mut f as*muti32);
14
14
thread::spawn(move || unsafe{
15
15
//~^ ERROR: `Send` trait implementation for closure
16
-
//~| NOTE: in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure would no longer implement `Send` as `fptr.0` does not implement `Send`
16
+
//~| NOTE: in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
17
17
//~| NOTE: for more information, see
18
18
//~| HELP: add a dummy let to cause `fptr` to be fully captured
19
19
*fptr.0 = 20;
20
-
//~^ NOTE: in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0`
20
+
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
21
21
});
22
22
}
23
23
@@ -33,11 +33,11 @@ fn test_sync_trait() {
33
33
let fptr = SyncPointer(f);
34
34
thread::spawn(move || unsafe{
35
35
//~^ ERROR: `Sync`, `Send` trait implementation for closure
36
-
//~| NOTE: in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure would no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
36
+
//~| NOTE: in Rust 2018, this closure implements `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
37
37
//~| NOTE: for more information, see
38
38
//~| HELP: add a dummy let to cause `fptr` to be fully captured
39
39
*fptr.0.0 = 20;
40
-
//~^ NOTE: in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0.0`
40
+
//~^ NOTE: in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
41
41
});
42
42
}
43
43
@@ -57,19 +57,19 @@ fn test_clone_trait() {
57
57
let f = U(S(String::from("Hello World")),T(0));
58
58
let c = || {
59
59
//~^ ERROR: `Clone` trait implementation for closure and drop order
60
-
//~| NOTE: in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f.1` does not implement `Clone`
60
+
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
61
61
//~| NOTE: for more information, see
62
62
//~| HELP: add a dummy let to cause `f` to be fully captured
63
63
let f_1 = f.1;
64
-
//~^ NOTE: in Rust 2018, closure captures all of `f`, but in Rust 2021, it only captures `f.1`
64
+
//~^ NOTE: in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.1`
65
65
println!("{:?}", f_1.0);
66
66
};
67
67
68
68
let c_clone = c.clone();
69
69
70
70
c_clone();
71
71
}
72
-
//~^ NOTE: in Rust 2018, `f` would be dropped here, but in Rust 2021, only `f.1` would be dropped here alongside the closure
72
+
//~^ NOTE: in Rust 2018, `f` is dropped here, but in Rust 2021, only `f.1` will be dropped here as part of the closure
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
+7-7
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@ error: changes to closure capture in Rust 2021 will affect `Send` trait implemen
2
2
--> $DIR/auto_traits.rs:14:19
3
3
|
4
4
LL | thread::spawn(move || unsafe {
5
-
| ^^^^^^^^^^^^^^ in Rust 2018, this closure would implement `Send` as `fptr` implements `Send`, but in Rust 2021, this closure would no longer implement `Send` as `fptr.0` does not implement `Send`
5
+
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
6
6
...
7
7
LL | *fptr.0 = 20;
8
-
| ------- in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0`
8
+
| ------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
9
9
|
10
10
note: the lint level is defined here
11
11
--> $DIR/auto_traits.rs:2:9
@@ -27,10 +27,10 @@ error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` trait
27
27
--> $DIR/auto_traits.rs:34:19
28
28
|
29
29
LL | thread::spawn(move || unsafe {
30
-
| ^^^^^^^^^^^^^^ in Rust 2018, this closure would implement `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure would no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
30
+
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
31
31
...
32
32
LL | *fptr.0.0 = 20;
33
-
| --------- in Rust 2018, closure captures all of `fptr`, but in Rust 2021, it only captures `fptr.0.0`
33
+
| --------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
34
34
|
35
35
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
36
36
help: add a dummy let to cause `fptr` to be fully captured
@@ -47,13 +47,13 @@ error: changes to closure capture in Rust 2021 will affect `Clone` trait impleme
47
47
--> $DIR/auto_traits.rs:58:13
48
48
|
49
49
LL | let c = || {
50
-
| ^^ in Rust 2018, this closure would implement `Clone` as `f` implements `Clone`, but in Rust 2021, this closure would no longer implement `Clone` as `f.1` does not implement `Clone`
50
+
| ^^ in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
51
51
...
52
52
LL | let f_1 = f.1;
53
-
| --- in Rust 2018, closure captures all of `f`, but in Rust 2021, it only captures `f.1`
53
+
| --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.1`
54
54
...
55
55
LL | }
56
-
| - in Rust 2018, `f` would be dropped here, but in Rust 2021, only `f.1` would be dropped here alongside the closure
56
+
| - in Rust 2018, `f` is dropped here, but in Rust 2021, only `f.1` will be dropped here as part of the closure
57
57
|
58
58
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html>
59
59
help: add a dummy let to cause `f` to be fully captured
0 commit comments