Skip to content

Commit 11abaa1

Browse files
committed
New migration
1 parent f106e18 commit 11abaa1

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
lines changed

Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -5388,7 +5388,7 @@ dependencies = [
53885388
"chrono",
53895389
"lazy_static",
53905390
"matchers",
5391-
"parking_lot 0.11.0",
5391+
"parking_lot 0.9.0",
53925392
"regex",
53935393
"serde",
53945394
"serde_json",

compiler/rustc_typeck/src/check/upvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ fn migration_suggestion_for_2229(tcx: TyCtxt<'_>, need_migrations: &Vec<hir::Hir
11731173
need_migrations.iter().map(|v| format!("{}", var_name(tcx, *v))).collect::<Vec<_>>();
11741174
let migrations_list_concat = need_migrations_strings.join(", ");
11751175

1176-
format!("let ({}) = ({});", migrations_list_concat, migrations_list_concat)
1176+
format!("drop(&({}));", migrations_list_concat)
11771177
}
11781178

11791179
/// Helper function to determine if we need to escalate CaptureKind from

src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn test1_all_need_migration() {
1212

1313
let c = || {
1414
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
15-
//~| NOTE: let (t, t1, t2) = (t, t1, t2);
15+
//~| NOTE: drop(&(t, t1, t2));
1616
let _t = t.0;
1717
let _t1 = t1.0;
1818
let _t2 = t2.0;
@@ -30,7 +30,7 @@ fn test2_only_precise_paths_need_migration() {
3030

3131
let c = || {
3232
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
33-
//~| NOTE: let (t, t1) = (t, t1);
33+
//~| NOTE: drop(&(t, t1));
3434
let _t = t.0;
3535
let _t1 = t1.0;
3636
let _t2 = t2;
@@ -46,7 +46,7 @@ fn test3_only_by_value_need_migration() {
4646
let t1 = (String::new(), String::new());
4747
let c = || {
4848
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
49-
//~| NOTE: let (t) = (t);
49+
//~| NOTE: drop(&(t));
5050
let _t = t.0;
5151
println!("{}", t1.1);
5252
};
@@ -64,7 +64,7 @@ fn test4_only_non_copy_types_need_migration() {
6464

6565
let c = || {
6666
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
67-
//~| NOTE: let (t) = (t);
67+
//~| NOTE: drop(&(t));
6868
let _t = t.0;
6969
let _t1 = t1.0;
7070
};
@@ -82,7 +82,7 @@ fn test5_only_drop_types_need_migration() {
8282

8383
let c = || {
8484
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
85-
//~| NOTE: let (t) = (t);
85+
//~| NOTE: drop(&(t));
8686
let _t = t.0;
8787
let _s = s.0;
8888
};
@@ -97,7 +97,7 @@ fn test6_move_closures_non_copy_types_might_need_migration() {
9797
let t1 = (String::new(), String::new());
9898
let c = move || {
9999
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
100-
//~| NOTE: let (t1, t) = (t1, t);
100+
//~| NOTE: drop(&(t1, t));
101101
println!("{} {}", t1.1, t.1);
102102
};
103103

@@ -112,7 +112,7 @@ fn test7_drop_non_drop_aggregate_need_migration() {
112112

113113
let c = || {
114114
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
115-
//~| NOTE: let (t) = (t);
115+
//~| NOTE: drop(&(t));
116116
let _t = t.0;
117117
};
118118

src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ note: the lint level is defined here
1616
|
1717
LL | #![deny(disjoint_capture_drop_reorder)]
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19-
= note: let (t, t1, t2) = (t, t1, t2);
19+
= note: drop(&(t, t1, t2));
2020

2121
error: Drop order affected for closure because of `capture_disjoint_fields`
2222
--> $DIR/insignificant_drop.rs:31:13
@@ -31,7 +31,7 @@ LL | | let _t2 = t2;
3131
LL | | };
3232
| |_____^
3333
|
34-
= note: let (t, t1) = (t, t1);
34+
= note: drop(&(t, t1));
3535

3636
error: Drop order affected for closure because of `capture_disjoint_fields`
3737
--> $DIR/insignificant_drop.rs:47:13
@@ -45,7 +45,7 @@ LL | | println!("{}", t1.1);
4545
LL | | };
4646
| |_____^
4747
|
48-
= note: let (t) = (t);
48+
= note: drop(&(t));
4949

5050
error: Drop order affected for closure because of `capture_disjoint_fields`
5151
--> $DIR/insignificant_drop.rs:65:13
@@ -59,7 +59,7 @@ LL | | let _t1 = t1.0;
5959
LL | | };
6060
| |_____^
6161
|
62-
= note: let (t) = (t);
62+
= note: drop(&(t));
6363

6464
error: Drop order affected for closure because of `capture_disjoint_fields`
6565
--> $DIR/insignificant_drop.rs:83:13
@@ -73,7 +73,7 @@ LL | | let _s = s.0;
7373
LL | | };
7474
| |_____^
7575
|
76-
= note: let (t) = (t);
76+
= note: drop(&(t));
7777

7878
error: Drop order affected for closure because of `capture_disjoint_fields`
7979
--> $DIR/insignificant_drop.rs:98:13
@@ -86,7 +86,7 @@ LL | | println!("{} {}", t1.1, t.1);
8686
LL | | };
8787
| |_____^
8888
|
89-
= note: let (t1, t) = (t1, t);
89+
= note: drop(&(t1, t));
9090

9191
error: Drop order affected for closure because of `capture_disjoint_fields`
9292
--> $DIR/insignificant_drop.rs:113:13
@@ -99,7 +99,7 @@ LL | | let _t = t.0;
9999
LL | | };
100100
| |_____^
101101
|
102-
= note: let (t) = (t);
102+
= note: drop(&(t));
103103

104104
error: aborting due to 7 previous errors
105105

src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn test1_all_need_migration() {
2323

2424
let c = || {
2525
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
26-
//~| NOTE: let (t, t1, t2) = (t, t1, t2);
26+
//~| NOTE: drop(&(t, t1, t2));
2727
let _t = t.0;
2828
let _t1 = t1.0;
2929
let _t2 = t2.0;
@@ -41,7 +41,7 @@ fn test2_only_precise_paths_need_migration() {
4141

4242
let c = || {
4343
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
44-
//~| NOTE: let (t, t1) = (t, t1);
44+
//~| NOTE: drop(&(t, t1));
4545
let _t = t.0;
4646
let _t1 = t1.0;
4747
let _t2 = t2;
@@ -57,7 +57,7 @@ fn test3_only_by_value_need_migration() {
5757
let t1 = (Foo(0), Foo(0));
5858
let c = || {
5959
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
60-
//~| NOTE: let (t) = (t);
60+
//~| NOTE: drop(&(t));
6161
let _t = t.0;
6262
println!("{:?}", t1.1);
6363
};
@@ -74,7 +74,7 @@ fn test4_type_contains_drop_need_migration() {
7474

7575
let c = || {
7676
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
77-
//~| NOTE: let (t) = (t);
77+
//~| NOTE: drop(&(t));
7878
let _t = t.0;
7979
};
8080

@@ -89,7 +89,7 @@ fn test5_drop_non_drop_aggregate_need_migration() {
8989

9090
let c = || {
9191
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
92-
//~| NOTE: let (t) = (t);
92+
//~| NOTE: drop(&(t));
9393
let _t = t.0;
9494
};
9595

@@ -104,7 +104,7 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() {
104104

105105
let c = || {
106106
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
107-
//~| NOTE: let (t) = (t);
107+
//~| NOTE: drop(&(t));
108108
let _t = t.1;
109109
};
110110

@@ -119,7 +119,7 @@ fn test7_move_closures_non_copy_types_might_need_migration() {
119119

120120
let c = move || {
121121
//~^ERROR: Drop order affected for closure because of `capture_disjoint_fields`
122-
//~| NOTE: let (t1, t) = (t1, t);
122+
//~| NOTE: drop(&(t1, t));
123123
println!("{:?} {:?}", t1.1, t.1);
124124
};
125125

src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ note: the lint level is defined here
1616
|
1717
LL | #![deny(disjoint_capture_drop_reorder)]
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19-
= note: let (t, t1, t2) = (t, t1, t2);
19+
= note: drop(&(t, t1, t2));
2020

2121
error: Drop order affected for closure because of `capture_disjoint_fields`
2222
--> $DIR/significant_drop.rs:42:13
@@ -31,7 +31,7 @@ LL | | let _t2 = t2;
3131
LL | | };
3232
| |_____^
3333
|
34-
= note: let (t, t1) = (t, t1);
34+
= note: drop(&(t, t1));
3535

3636
error: Drop order affected for closure because of `capture_disjoint_fields`
3737
--> $DIR/significant_drop.rs:58:13
@@ -45,7 +45,7 @@ LL | | println!("{:?}", t1.1);
4545
LL | | };
4646
| |_____^
4747
|
48-
= note: let (t) = (t);
48+
= note: drop(&(t));
4949

5050
error: Drop order affected for closure because of `capture_disjoint_fields`
5151
--> $DIR/significant_drop.rs:75:13
@@ -58,7 +58,7 @@ LL | | let _t = t.0;
5858
LL | | };
5959
| |_____^
6060
|
61-
= note: let (t) = (t);
61+
= note: drop(&(t));
6262

6363
error: Drop order affected for closure because of `capture_disjoint_fields`
6464
--> $DIR/significant_drop.rs:90:13
@@ -71,7 +71,7 @@ LL | | let _t = t.0;
7171
LL | | };
7272
| |_____^
7373
|
74-
= note: let (t) = (t);
74+
= note: drop(&(t));
7575

7676
error: Drop order affected for closure because of `capture_disjoint_fields`
7777
--> $DIR/significant_drop.rs:105:13
@@ -84,7 +84,7 @@ LL | | let _t = t.1;
8484
LL | | };
8585
| |_____^
8686
|
87-
= note: let (t) = (t);
87+
= note: drop(&(t));
8888

8989
error: Drop order affected for closure because of `capture_disjoint_fields`
9090
--> $DIR/significant_drop.rs:120:13
@@ -97,7 +97,7 @@ LL | | println!("{:?} {:?}", t1.1, t.1);
9797
LL | | };
9898
| |_____^
9999
|
100-
= note: let (t1, t) = (t1, t);
100+
= note: drop(&(t1, t));
101101

102102
error: aborting due to 7 previous errors
103103

0 commit comments

Comments
 (0)