New migration

This commit is contained in:
Aman Arora 2021-01-26 04:08:23 -05:00
parent 8f15cc1d88
commit 84f0a0a1c6
5 changed files with 29 additions and 29 deletions

View File

@ -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

View File

@ -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;
@ -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;
@ -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);
};
@ -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;
};
@ -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;
};
@ -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);
};
@ -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;
};

View File

@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -99,7 +99,7 @@ LL | | let _t = t.0;
LL | | };
| |_____^
|
= note: let (t) = (t);
= note: drop(&(t));
error: aborting due to 7 previous errors

View File

@ -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;
@ -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;
@ -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);
};
@ -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;
};
@ -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;
};
@ -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;
};
@ -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);
};

View File

@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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