From 11abaa13bb7b4cb684cd8eeda227313a2871891d Mon Sep 17 00:00:00 2001 From: Aman Arora Date: Tue, 26 Jan 2021 04:08:23 -0500 Subject: [PATCH] New migration --- Cargo.lock | 2 +- compiler/rustc_typeck/src/check/upvar.rs | 2 +- .../migrations/insignificant_drop.rs | 14 +++++++------- .../migrations/insignificant_drop.stderr | 14 +++++++------- .../migrations/significant_drop.rs | 14 +++++++------- .../migrations/significant_drop.stderr | 14 +++++++------- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4ba7704426e8..e7365e611cae7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5388,7 +5388,7 @@ dependencies = [ "chrono", "lazy_static", "matchers", - "parking_lot 0.11.0", + "parking_lot 0.9.0", "regex", "serde", "serde_json", diff --git a/compiler/rustc_typeck/src/check/upvar.rs b/compiler/rustc_typeck/src/check/upvar.rs index fff1323ddcb75..2490836296ce4 100644 --- a/compiler/rustc_typeck/src/check/upvar.rs +++ b/compiler/rustc_typeck/src/check/upvar.rs @@ -1173,7 +1173,7 @@ fn migration_suggestion_for_2229(tcx: TyCtxt<'_>, need_migrations: &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 diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs index 298cc1217602e..cf25f3c3ba81e 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.rs @@ -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; }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr index bf80d72aa0b1f..531759f61e01a 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/insignificant_drop.stderr @@ -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 diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs index 40699f48fab92..60d832849cc87 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.rs @@ -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); }; diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr index a2308e1ef9451..5543dccf2753d 100644 --- a/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr +++ b/src/test/ui/closures/2229_closure_analysis/migrations/significant_drop.stderr @@ -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