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
diagnostics_builder.span_label(drop_location_span,format!("in Rust 2018, `{}` is dropped here, but in Rust 2021, only `{}` will be dropped here as part of the closure",
diagnostics_builder.span_label(drop_location_span,format!("in Rust 2018, `{v}` is dropped here along with the closure, but in Rust 2021 `{v}` is not part of the closure",
diagnostics_builder.span_label(closure_head_span,format!("in Rust 2018, this closure implements {missing_trait} as `{x}` implements {missing_trait}, but in Rust 2021, this closure will no longer implement {missing_trait} as `{p}` does not implement {missing_trait}",
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.fixed
+4-4
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ fn test_send_trait() {
21
21
let fptr = SendPointer(&mut f as *mut i32);
22
22
thread::spawn(move || { let _ = &fptr; unsafe {
23
23
//~^ ERROR: changes to closure capture
24
-
//~| 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`
24
+
//~| NOTE: in Rust 2018, this closure implements `Send`
25
25
//~| NOTE: for more information, see
26
26
//~| HELP: add a dummy let to cause `fptr` to be fully captured
27
27
*fptr.0 = 20;
@@ -41,8 +41,8 @@ fn test_sync_trait() {
41
41
let fptr = SyncPointer(f);
42
42
thread::spawn(move || { let _ = &fptr; unsafe {
43
43
//~^ ERROR: changes to closure capture
44
-
//~| NOTE: in Rust 2018, this closure implements `Sync` as `fptr` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` as `fptr.0.0` does not implement `Sync`
45
-
//~| 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.0` does not implement `Send`
44
+
//~| NOTE: in Rust 2018, this closure implements `Sync`
45
+
//~| NOTE: in Rust 2018, this closure implements `Send`
46
46
//~| NOTE: for more information, see
47
47
//~| HELP: add a dummy let to cause `fptr` to be fully captured
48
48
*fptr.0.0 = 20;
@@ -67,7 +67,7 @@ fn test_clone_trait() {
67
67
let c = || {
68
68
let _ = &f;
69
69
//~^ ERROR: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
70
-
//~| 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`
70
+
//~| NOTE: in Rust 2018, this closure implements `Clone`
71
71
//~| NOTE: for more information, see
72
72
//~| HELP: add a dummy let to cause `f` to be fully captured
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs
+4-4
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ fn test_send_trait() {
21
21
let fptr = SendPointer(&mut f as*muti32);
22
22
thread::spawn(move || unsafe{
23
23
//~^ ERROR: changes to closure capture
24
-
//~| 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`
24
+
//~| NOTE: in Rust 2018, this closure implements `Send`
25
25
//~| NOTE: for more information, see
26
26
//~| HELP: add a dummy let to cause `fptr` to be fully captured
27
27
*fptr.0 = 20;
@@ -41,8 +41,8 @@ fn test_sync_trait() {
41
41
let fptr = SyncPointer(f);
42
42
thread::spawn(move || unsafe{
43
43
//~^ ERROR: changes to closure capture
44
-
//~| NOTE: in Rust 2018, this closure implements `Sync` as `fptr` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` as `fptr.0.0` does not implement `Sync`
45
-
//~| 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.0` does not implement `Send`
44
+
//~| NOTE: in Rust 2018, this closure implements `Sync`
45
+
//~| NOTE: in Rust 2018, this closure implements `Send`
46
46
//~| NOTE: for more information, see
47
47
//~| HELP: add a dummy let to cause `fptr` to be fully captured
48
48
*fptr.0.0 = 20;
@@ -66,7 +66,7 @@ fn test_clone_trait() {
66
66
let f = U(S(Foo(0)),T(0));
67
67
let c = || {
68
68
//~^ ERROR: changes to closure capture in Rust 2021 will affect drop order and which traits the closure implements
69
-
//~| 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`
69
+
//~| NOTE: in Rust 2018, this closure implements `Clone`
70
70
//~| NOTE: for more information, see
71
71
//~| HELP: add a dummy let to cause `f` to be fully captured
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
+4-4
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
2
2
--> $DIR/auto_traits.rs:22:19
3
3
|
4
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` 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` because `fptr` is not fully captured and `fptr.0` does not implement `Send`
6
6
...
7
7
LL | *fptr.0 = 20;
8
8
| ------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
@@ -29,8 +29,8 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
29
29
LL | thread::spawn(move || unsafe {
30
30
| ^^^^^^^^^^^^^^
31
31
| |
32
-
| in Rust 2018, this closure implements `Sync` as `fptr` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` as `fptr.0.0` does not implement `Sync`
33
-
| 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.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
+
| 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`
34
34
...
35
35
LL | *fptr.0.0 = 20;
36
36
| --------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0.0`
@@ -50,7 +50,7 @@ error: changes to closure capture in Rust 2021 will affect drop order and which
50
50
--> $DIR/auto_traits.rs:67:13
51
51
|
52
52
LL | let c = || {
53
-
| ^^ 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`
53
+
| ^^ 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`
54
54
...
55
55
LL | let f_1 = f.1;
56
56
| --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.1`
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.fixed
+2-2
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,8 @@ where
20
20
let result = panic::catch_unwind(move || {
21
21
let _ = &f;
22
22
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
23
-
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe` as `f` implements `UnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe` as `f.0` does not implement `UnwindSafe`
24
-
//~| NOTE: in Rust 2018, this closure implements `RefUnwindSafe` as `f` implements `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `RefUnwindSafe` as `f.0` does not implement `RefUnwindSafe`
23
+
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe`
24
+
//~| NOTE: in Rust 2018, this closure implements `RefUnwindSafe`
25
25
//~| NOTE: for more information, see
26
26
//~| HELP: add a dummy let to cause `f` to be fully captured
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.rs
+2-2
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,8 @@ where
19
19
let f = panic::AssertUnwindSafe(f);
20
20
let result = panic::catch_unwind(move || {
21
21
//~^ ERROR: changes to closure capture in Rust 2021 will affect which traits the closure implements [rust_2021_incompatible_closure_captures]
22
-
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe` as `f` implements `UnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe` as `f.0` does not implement `UnwindSafe`
23
-
//~| NOTE: in Rust 2018, this closure implements `RefUnwindSafe` as `f` implements `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `RefUnwindSafe` as `f.0` does not implement `RefUnwindSafe`
22
+
//~| NOTE: in Rust 2018, this closure implements `UnwindSafe`
23
+
//~| NOTE: in Rust 2018, this closure implements `RefUnwindSafe`
24
24
//~| NOTE: for more information, see
25
25
//~| HELP: add a dummy let to cause `f` to be fully captured
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/mir_calls_to_shims.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,8 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
4
4
LL | let result = panic::catch_unwind(move || {
5
5
| ^^^^^^^
6
6
| |
7
-
| in Rust 2018, this closure implements `UnwindSafe` as `f` implements `UnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe` as `f.0` does not implement `UnwindSafe`
8
-
| in Rust 2018, this closure implements `RefUnwindSafe` as `f` implements `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `RefUnwindSafe` as `f.0` does not implement `RefUnwindSafe`
7
+
| in Rust 2018, this closure implements `UnwindSafe` as `f` implements `UnwindSafe`, but in Rust 2021, this closure will no longer implement `UnwindSafe` because `f` is not fully captured and `f.0` does not implement `UnwindSafe`
8
+
| in Rust 2018, this closure implements `RefUnwindSafe` as `f` implements `RefUnwindSafe`, but in Rust 2021, this closure will no longer implement `RefUnwindSafe` because `f` is not fully captured and `f.0` does not implement `RefUnwindSafe`
9
9
...
10
10
LL | f.0()
11
11
| --- in Rust 2018, this closure captures all of `f`, but in Rust 2021, it will only capture `f.0`
0 commit comments