Skip to content

Commit

Permalink
New migration
Browse files Browse the repository at this point in the history
  • Loading branch information
arora-aman committed Feb 2, 2021
1 parent 8f15cc1 commit 84f0a0a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ fn migration_suggestion_for_2229(tcx: TyCtxt<'_>, need_migrations: &Vec<hir::Hir
need_migrations.iter().map(|v| format!("{}", var_name(tcx, *v))).collect::<Vec<_>>();
let migrations_list_concat = need_migrations_strings.join(", ");

format!("let ({}) = ({});", migrations_list_concat, migrations_list_concat)
format!("drop(&({}));", migrations_list_concat)
}

/// Helper function to determine if we need to escalate CaptureKind from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn test1_all_need_migration() {

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

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t, t1) = (t, t1);
//~| NOTE: drop(&(t, t1));
let _t = t.0;
let _t1 = t1.0;
let _t2 = t2;
Expand All @@ -46,7 +46,7 @@ fn test3_only_by_value_need_migration() {
let t1 = (String::new(), String::new());
let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.0;
println!("{}", t1.1);
};
Expand All @@ -64,7 +64,7 @@ fn test4_only_non_copy_types_need_migration() {

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.0;
let _t1 = t1.0;
};
Expand All @@ -82,7 +82,7 @@ fn test5_only_drop_types_need_migration() {

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.0;
let _s = s.0;
};
Expand All @@ -97,7 +97,7 @@ fn test6_move_closures_non_copy_types_might_need_migration() {
let t1 = (String::new(), String::new());
let c = move || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t1, t) = (t1, t);
//~| NOTE: drop(&(t1, t));
println!("{} {}", t1.1, t.1);
};

Expand All @@ -112,7 +112,7 @@ fn test7_drop_non_drop_aggregate_need_migration() {

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.0;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ note: the lint level is defined here
|
LL | #![deny(disjoint_capture_drop_reorder)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: let (t, t1, t2) = (t, t1, t2);
= note: drop(&(t, t1, t2));

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

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

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

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

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

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

error: aborting due to 7 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn test1_all_need_migration() {

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

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t, t1) = (t, t1);
//~| NOTE: drop(&(t, t1));
let _t = t.0;
let _t1 = t1.0;
let _t2 = t2;
Expand All @@ -57,7 +57,7 @@ fn test3_only_by_value_need_migration() {
let t1 = (Foo(0), Foo(0));
let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.0;
println!("{:?}", t1.1);
};
Expand All @@ -74,7 +74,7 @@ fn test4_type_contains_drop_need_migration() {

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.0;
};

Expand All @@ -89,7 +89,7 @@ fn test5_drop_non_drop_aggregate_need_migration() {

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.0;
};

Expand All @@ -104,7 +104,7 @@ fn test6_significant_insignificant_drop_aggregate_need_migration() {

let c = || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t) = (t);
//~| NOTE: drop(&(t));
let _t = t.1;
};

Expand All @@ -119,7 +119,7 @@ fn test7_move_closures_non_copy_types_might_need_migration() {

let c = move || {
//~^ERROR: drop order affected for closure because of `capture_disjoint_fields`
//~| NOTE: let (t1, t) = (t1, t);
//~| NOTE: drop(&(t1, t));
println!("{:?} {:?}", t1.1, t.1);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ note: the lint level is defined here
|
LL | #![deny(disjoint_capture_drop_reorder)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: let (t, t1, t2) = (t, t1, t2);
= note: drop(&(t, t1, t2));

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

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

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

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

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

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

error: aborting due to 7 previous errors

0 comments on commit 84f0a0a

Please sign in to comment.