From 30058df867fbe5c43f90707d6fb644fba6201c2a Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 27 Dec 2019 17:53:00 +0000 Subject: [PATCH] Update existing tests for or-patterns --- src/test/mir-opt/const_prop/discriminant.rs | 24 ++-- src/test/mir-opt/issue-62289.rs | 62 ++++----- src/test/mir-opt/match-arm-scopes.rs | 110 ++++++++-------- src/test/mir-opt/match_false_edges.rs | 120 +++++++++--------- src/test/mir-opt/match_test.rs | 28 ++-- src/test/mir-opt/remove_fake_borrows.rs | 24 ++-- src/test/mir-opt/simplify_try.rs | 44 +++---- src/test/ui/consts/const_let_refutable.rs | 8 +- src/test/ui/consts/const_let_refutable.stderr | 28 ++-- src/test/ui/empty/empty-never-array.rs | 1 - src/test/ui/empty/empty-never-array.stderr | 11 +- src/test/ui/issues/issue-12567.stderr | 28 ++-- src/test/ui/issues/issue-15381.rs | 1 - src/test/ui/issues/issue-15381.stderr | 11 +- .../ui/or-patterns/consistent-bindings.rs | 46 +++---- .../ui/or-patterns/consistent-bindings.stderr | 9 -- .../exhaustiveness-non-exhaustive.rs | 7 +- .../exhaustiveness-non-exhaustive.stderr | 14 +- .../ui/or-patterns/exhaustiveness-pass.rs | 9 +- .../ui/or-patterns/exhaustiveness-pass.stderr | 8 -- .../exhaustiveness-unreachable-pattern.rs | 7 +- .../exhaustiveness-unreachable-pattern.stderr | 48 +++---- .../ui/or-patterns/feature-gate-const-fn.rs | 2 + .../or-patterns/feature-gate-const-fn.stderr | 17 ++- .../recursive-types-are-not-uninhabited.rs | 1 - ...recursive-types-are-not-uninhabited.stderr | 11 +- .../duplicate-suggestions.stderr | 30 +++-- .../dont-suggest-ref/simple.stderr | 51 +++++--- 28 files changed, 361 insertions(+), 399 deletions(-) delete mode 100644 src/test/ui/or-patterns/consistent-bindings.stderr delete mode 100644 src/test/ui/or-patterns/exhaustiveness-pass.stderr diff --git a/src/test/mir-opt/const_prop/discriminant.rs b/src/test/mir-opt/const_prop/discriminant.rs index 07bbd9202b9..667d21fc14e 100644 --- a/src/test/mir-opt/const_prop/discriminant.rs +++ b/src/test/mir-opt/const_prop/discriminant.rs @@ -10,18 +10,18 @@ fn main() { // ... // _3 = std::option::Option::::Some(const true,); // _4 = discriminant(_3); -// switchInt(move _4) -> [1isize: bb3, otherwise: bb2]; +// switchInt(move _4) -> [1isize: bb2, otherwise: bb1]; // } // bb1: { -// _2 = const 42i32; -// goto -> bb4; -// } -// bb2: { // _2 = const 10i32; // goto -> bb4; // } +// bb2: { +// switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; +// } // bb3: { -// switchInt(((_3 as Some).0: bool)) -> [false: bb2, otherwise: bb1]; +// _2 = const 42i32; +// goto -> bb4; // } // bb4: { // _1 = Add(move _2, const 0i32); @@ -33,18 +33,18 @@ fn main() { // ... // _3 = const Scalar(0x01) : std::option::Option; // _4 = const 1isize; -// switchInt(const 1isize) -> [1isize: bb3, otherwise: bb2]; +// switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // } // bb1: { -// _2 = const 42i32; -// goto -> bb4; -// } -// bb2: { // _2 = const 10i32; // goto -> bb4; // } +// bb2: { +// switchInt(const true) -> [false: bb1, otherwise: bb3]; +// } // bb3: { -// switchInt(const true) -> [false: bb2, otherwise: bb1]; +// _2 = const 42i32; +// goto -> bb4; // } // bb4: { // _1 = Add(move _2, const 0i32); diff --git a/src/test/mir-opt/issue-62289.rs b/src/test/mir-opt/issue-62289.rs index a3b517e9bca..8e619ffdf8b 100644 --- a/src/test/mir-opt/issue-62289.rs +++ b/src/test/mir-opt/issue-62289.rs @@ -32,41 +32,12 @@ fn main() { // bb2: { // StorageDead(_4); // _5 = discriminant(_3); -// switchInt(move _5) -> [0isize: bb10, 1isize: bb5, otherwise: bb4]; +// switchInt(move _5) -> [0isize: bb4, 1isize: bb6, otherwise: bb5]; // } // bb3 (cleanup): { // drop(_2) -> bb1; // } // bb4: { -// unreachable; -// } -// bb5: { -// StorageLive(_6); -// _6 = ((_3 as Err).0: std::option::NoneError); -// StorageLive(_8); -// StorageLive(_9); -// _9 = _6; -// _8 = const >::from(move _9) -> [return: bb7, unwind: bb3]; -// } -// bb6: { -// return; -// } -// bb7: { -// StorageDead(_9); -// _0 = const > as std::ops::Try>::from_error(move _8) -> [return: bb8, unwind: bb3]; -// } -// bb8: { -// StorageDead(_8); -// StorageDead(_6); -// drop(_2) -> bb9; -// } -// bb9: { -// StorageDead(_2); -// StorageDead(_1); -// StorageDead(_3); -// goto -> bb6; -// } -// bb10: { // StorageLive(_10); // _10 = ((_3 as Ok).0: u32); // (*_2) = _10; @@ -74,6 +45,35 @@ fn main() { // _1 = move _2; // drop(_2) -> [return: bb12, unwind: bb11]; // } +// bb5: { +// unreachable; +// } +// bb6: { +// StorageLive(_6); +// _6 = ((_3 as Err).0: std::option::NoneError); +// StorageLive(_8); +// StorageLive(_9); +// _9 = _6; +// _8 = const >::from(move _9) -> [return: bb8, unwind: bb3]; +// } +// bb7: { +// return; +// } +// bb8: { +// StorageDead(_9); +// _0 = const > as std::ops::Try>::from_error(move _8) -> [return: bb9, unwind: bb3]; +// } +// bb9: { +// StorageDead(_8); +// StorageDead(_6); +// drop(_2) -> bb10; +// } +// bb10: { +// StorageDead(_2); +// StorageDead(_1); +// StorageDead(_3); +// goto -> bb7; +// } // bb11 (cleanup): { // drop(_1) -> bb1; // } @@ -85,7 +85,7 @@ fn main() { // bb13: { // StorageDead(_1); // StorageDead(_3); -// goto -> bb6; +// goto -> bb7; // } // } // END rustc.test.ElaborateDrops.before.mir diff --git a/src/test/mir-opt/match-arm-scopes.rs b/src/test/mir-opt/match-arm-scopes.rs index 4412a16e74d..7afc3bbd6fa 100644 --- a/src/test/mir-opt/match-arm-scopes.rs +++ b/src/test/mir-opt/match-arm-scopes.rs @@ -28,10 +28,7 @@ const CASES: &[(bool, bool, bool, i32)] = &[ fn main() { for &(cond, items_1, items_2, result) in CASES { - assert_eq!( - complicated_match(cond, (items_1, items_2, String::new())), - result, - ); + assert_eq!(complicated_match(cond, (items_1, items_2, String::new())), result,); } } @@ -64,31 +61,38 @@ fn main() { // } // bb0: { // FakeRead(ForMatchedPlace, _2); -// switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb5]; +// switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb3]; // } // bb1 (cleanup): { // resume; // } -// bb2: { -// falseEdges -> [real: bb8, imaginary: bb3]; +// bb2: { // pre-binding for arm 1 first pattern +// falseEdges -> [real: bb9, imaginary: bb4]; // } // bb3: { -// falseEdges -> [real: bb17, imaginary: bb4]; +// switchInt((_2.1: bool)) -> [false: bb4, otherwise: bb5]; // } -// bb4: { -// falseEdges -> [real: bb25, imaginary: bb26]; +// bb4: { // pre-binding for arm 1 second pattern +// falseEdges -> [real: bb18, imaginary: bb6]; // } // bb5: { -// switchInt((_2.1: bool)) -> [false: bb3, otherwise: bb6]; +// switchInt((_2.0: bool)) -> [false: bb7, otherwise: bb6]; // } -// bb6: { -// switchInt((_2.0: bool)) -> [false: bb26, otherwise: bb4]; +// bb6: { // pre-binding for arm 2 first pattern +// falseEdges -> [real: bb26, imaginary: bb7]; // } -// bb7: { // arm 1 +// bb7: { // bindings for arm 2 - second pattern +// StorageLive(_15); +// _15 = (_2.1: bool); +// StorageLive(_16); +// _16 = move (_2.2: std::string::String); +// goto -> bb25; +// } +// bb8: { // arm 1 // _0 = const 1i32; -// drop(_7) -> [return: bb23, unwind: bb13]; +// drop(_7) -> [return: bb24, unwind: bb14]; // } -// bb8: { // guard - first time +// bb9: { // guard - first time // StorageLive(_6); // _6 = &(_2.1: bool); // StorageLive(_8); @@ -99,34 +103,34 @@ fn main() { // StorageLive(_10); // _10 = _1; // FakeRead(ForMatchedPlace, _10); -// switchInt(_10) -> [false: bb10, otherwise: bb9]; +// switchInt(_10) -> [false: bb11, otherwise: bb10]; // } -// bb9: { -// falseEdges -> [real: bb11, imaginary: bb10]; +// bb10: { +// falseEdges -> [real: bb12, imaginary: bb11]; // } -// bb10: { // `else` block - first time +// bb11: { // `else` block - first time // _9 = (*_6); // StorageDead(_10); -// switchInt(move _9) -> [false: bb16, otherwise: bb15]; +// switchInt(move _9) -> [false: bb17, otherwise: bb16]; // } -// bb11: { // `return 3` - first time +// bb12: { // `return 3` - first time // _0 = const 3i32; // StorageDead(_10); // StorageDead(_9); // StorageDead(_8); // StorageDead(_6); -// goto -> bb14; +// goto -> bb15; // } -// bb12: { +// bb13: { // return; // } -// bb13 (cleanup): { +// bb14 (cleanup): { // drop(_2) -> bb1; // } -// bb14: { -// drop(_2) -> [return: bb12, unwind: bb1]; -// } // bb15: { +// drop(_2) -> [return: bb13, unwind: bb1]; +// } +// bb16: { // StorageDead(_9); // FakeRead(ForMatchGuard, _3); // FakeRead(ForMatchGuard, _4); @@ -136,15 +140,15 @@ fn main() { // _5 = (_2.1: bool); // StorageLive(_7); // _7 = move (_2.2: std::string::String); -// goto -> bb7; +// goto -> bb8; // } -// bb16: { // guard otherwise case - first time +// bb17: { // guard otherwise case - first time // StorageDead(_9); // StorageDead(_8); // StorageDead(_6); -// falseEdges -> [real: bb5, imaginary: bb3]; +// falseEdges -> [real: bb3, imaginary: bb4]; // } -// bb17: { // guard - second time +// bb18: { // guard - second time // StorageLive(_6); // _6 = &(_2.0: bool); // StorageLive(_8); @@ -155,25 +159,25 @@ fn main() { // StorageLive(_13); // _13 = _1; // FakeRead(ForMatchedPlace, _13); -// switchInt(_13) -> [false: bb19, otherwise: bb18]; +// switchInt(_13) -> [false: bb20, otherwise: bb19]; // } -// bb18: { -// falseEdges -> [real: bb20, imaginary: bb19]; +// bb19: { +// falseEdges -> [real: bb21, imaginary: bb20]; // } -// bb19: { // `else` block - second time +// bb20: { // `else` block - second time // _12 = (*_6); // StorageDead(_13); -// switchInt(move _12) -> [false: bb22, otherwise: bb21]; +// switchInt(move _12) -> [false: bb23, otherwise: bb22]; // } -// bb20: { +// bb21: { // _0 = const 3i32; // StorageDead(_13); // StorageDead(_12); // StorageDead(_8); // StorageDead(_6); -// goto -> bb14; +// goto -> bb15; // } -// bb21: { // bindings for arm 1 +// bb22: { // bindings for arm 1 // StorageDead(_12); // FakeRead(ForMatchGuard, _3); // FakeRead(ForMatchGuard, _4); @@ -183,46 +187,40 @@ fn main() { // _5 = (_2.0: bool); // StorageLive(_7); // _7 = move (_2.2: std::string::String); -// goto -> bb7; +// goto -> bb8; // } -// bb22: { // Guard otherwise case - second time +// bb23: { // Guard otherwise case - second time // StorageDead(_12); // StorageDead(_8); // StorageDead(_6); -// falseEdges -> [real: bb6, imaginary: bb4]; +// falseEdges -> [real: bb5, imaginary: bb6]; // } -// bb23: { // rest of arm 1 +// bb24: { // rest of arm 1 // StorageDead(_7); // StorageDead(_5); // StorageDead(_8); // StorageDead(_6); // goto -> bb28; // } -// bb24: { // arm 2 +// bb25: { // arm 2 // _0 = const 2i32; -// drop(_16) -> [return: bb27, unwind: bb13]; +// drop(_16) -> [return: bb27, unwind: bb14]; // } -// bb25: { // bindings for arm 2 - first pattern +// bb26: { // bindings for arm 2 - first pattern // StorageLive(_15); // _15 = (_2.1: bool); // StorageLive(_16); // _16 = move (_2.2: std::string::String); -// goto -> bb24; -// } -// bb26: { // bindings for arm 2 - second pattern -// StorageLive(_15); -// _15 = (_2.1: bool); -// StorageLive(_16); -// _16 = move (_2.2: std::string::String); -// goto -> bb24; +// goto -> bb25; // } + // bb27: { // rest of arm 2 // StorageDead(_16); // StorageDead(_15); // goto -> bb28; // } // bb28: { -// drop(_2) -> [return: bb12, unwind: bb1]; +// drop(_2) -> [return: bb13, unwind: bb1]; // } // END rustc.complicated_match.SimplifyCfg-initial.after.mir // START rustc.complicated_match.ElaborateDrops.after.mir diff --git a/src/test/mir-opt/match_false_edges.rs b/src/test/mir-opt/match_false_edges.rs index 2c20c35e4a4..237828d9020 100644 --- a/src/test/mir-opt/match_false_edges.rs +++ b/src/test/mir-opt/match_false_edges.rs @@ -4,7 +4,7 @@ fn guard() -> bool { false } -fn guard2(_:i32) -> bool { +fn guard2(_: i32) -> bool { true } @@ -45,21 +45,21 @@ fn main() { // _2 = std::option::Option::::Some(const 42i32,); // FakeRead(ForMatchedPlace, _2); // _3 = discriminant(_2); -// switchInt(move _3) -> [0isize: bb4, 1isize: bb2, otherwise: bb5]; +// switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5]; // } // bb1 (cleanup): { // resume; // } -// bb2: { -// falseEdges -> [real: bb6, imaginary: bb3]; //pre_binding1 -// } -// bb3: { -// falseEdges -> [real: bb10, imaginary: bb4]; //pre_binding2 -// } -// bb4: { //pre_binding3 and arm3 +// bb2: { // pre_binding3 and arm3 // _1 = (const 3i32, const 3i32); // goto -> bb11; // } +// bb3: { +// falseEdges -> [real: bb6, imaginary: bb4]; //pre_binding1 +// } +// bb4: { +// falseEdges -> [real: bb10, imaginary: bb2]; //pre_binding2 +// } // bb5: { // unreachable; // } @@ -91,7 +91,7 @@ fn main() { // bb9: { // to pre_binding2 // StorageDead(_7); // StorageDead(_6); -// goto -> bb3; +// goto -> bb4; // } // bb10: { // arm2 // StorageLive(_9); @@ -103,7 +103,7 @@ fn main() { // StorageDead(_9); // goto -> bb11; // } -// bb11: { // arm3 +// bb11: { // StorageDead(_2); // StorageDead(_1); // _0 = (); @@ -117,31 +117,41 @@ fn main() { // _2 = std::option::Option::::Some(const 42i32,); // FakeRead(ForMatchedPlace, _2); // _3 = discriminant(_2); -// switchInt(move _3) -> [0isize: bb3, 1isize: bb2, otherwise: bb4]; +// switchInt(move _3) -> [0isize: bb2, 1isize: bb3, otherwise: bb5]; // } // bb1 (cleanup): { // resume; // } -// bb2: { -// falseEdges -> [real: bb5, imaginary: bb3]; +// bb2: { // pre_binding2 +// falseEdges -> [real: bb10, imaginary: bb4]; // } -// bb3: { -// falseEdges -> [real: bb9, imaginary: bb10]; +// bb3: { // pre_binding1 +// falseEdges -> [real: bb6, imaginary: bb2]; // } -// bb4: { // to arm3 (can skip 2 since this is `Some`) +// bb4: { // binding3 and arm3 +// StorageLive(_9); +// _9 = ((_2 as Some).0: i32); +// StorageLive(_10); +// _10 = _9; +// _1 = (const 2i32, move _10); +// StorageDead(_10); +// StorageDead(_9); +// goto -> bb11; +// } +// bb5: { // unreachable; // } -// bb5: { // binding1 and guard +// bb6: { // StorageLive(_6); // _6 = &((_2 as Some).0: i32); // _4 = &shallow _2; // StorageLive(_7); -// _7 = const guard() -> [return: bb6, unwind: bb1]; +// _7 = const guard() -> [return: bb7, unwind: bb1]; // } -// bb6: { // end of guard -// switchInt(move _7) -> [false: bb8, otherwise: bb7]; +// bb7: { // end of guard +// switchInt(move _7) -> [false: bb9, otherwise: bb8]; // } -// bb7: { +// bb8: { // StorageDead(_7); // FakeRead(ForMatchGuard, _4); // FakeRead(ForGuardBinding, _6); @@ -155,25 +165,15 @@ fn main() { // StorageDead(_6); // goto -> bb11; // } -// bb8: { // to pre_binding3 (can skip 2 since this is `Some`) +// bb9: { // to pre_binding3 (can skip 2 since this is `Some`) // StorageDead(_7); // StorageDead(_6); -// falseEdges -> [real: bb10, imaginary: bb3]; +// falseEdges -> [real: bb4, imaginary: bb2]; // } -// bb9: { // arm2 +// bb10: { // arm2 // _1 = (const 3i32, const 3i32); // goto -> bb11; // } -// bb10: { // binding3 and arm3 -// StorageLive(_9); -// _9 = ((_2 as Some).0: i32); -// StorageLive(_10); -// _10 = _9; -// _1 = (const 2i32, move _10); -// StorageDead(_10); -// StorageDead(_9); -// goto -> bb11; -// } // bb11: { // StorageDead(_2); // StorageDead(_1); @@ -188,31 +188,38 @@ fn main() { // _2 = std::option::Option::::Some(const 1i32,); // FakeRead(ForMatchedPlace, _2); // _4 = discriminant(_2); -// switchInt(move _4) -> [1isize: bb2, otherwise: bb3]; +// switchInt(move _4) -> [1isize: bb3, otherwise: bb2]; // } // bb1 (cleanup): { // resume; // } // bb2: { -// falseEdges -> [real: bb5, imaginary: bb3]; +// falseEdges -> [real: bb10, imaginary: bb5]; // } // bb3: { -// falseEdges -> [real: bb9, imaginary: bb4]; +// falseEdges -> [real: bb6, imaginary: bb2]; // } // bb4: { -// falseEdges -> [real: bb10, imaginary: bb14]; +// StorageLive(_14); +// _14 = _2; +// _1 = const 4i32; +// StorageDead(_14); +// goto -> bb15; // } // bb5: { +// falseEdges -> [real: bb11, imaginary: bb4]; +// } +// bb6: { //end of guard1 // StorageLive(_7); // _7 = &((_2 as Some).0: i32); // _5 = &shallow _2; // StorageLive(_8); -// _8 = const guard() -> [return: bb6, unwind: bb1]; -// } -// bb6: { //end of guard1 -// switchInt(move _8) -> [false: bb8, otherwise: bb7]; +// _8 = const guard() -> [return: bb7, unwind: bb1]; // } // bb7: { +// switchInt(move _8) -> [false: bb9, otherwise: bb8]; +// } +// bb8: { // StorageDead(_8); // FakeRead(ForMatchGuard, _5); // FakeRead(ForGuardBinding, _7); @@ -223,32 +230,32 @@ fn main() { // StorageDead(_7); // goto -> bb15; // } -// bb8: { +// bb9: { // StorageDead(_8); // StorageDead(_7); -// falseEdges -> [real: bb3, imaginary: bb3]; +// falseEdges -> [real: bb2, imaginary: bb2]; // } -// bb9: { // binding2 & arm2 +// bb10: { // binding2 & arm2 // StorageLive(_9); // _9 = _2; // _1 = const 2i32; // StorageDead(_9); // goto -> bb15; // } -// bb10: { // binding3: Some(y) if guard2(y) +// bb11: { // binding3: Some(y) if guard2(y) // StorageLive(_11); // _11 = &((_2 as Some).0: i32); // _5 = &shallow _2; // StorageLive(_12); // StorageLive(_13); // _13 = (*_11); -// _12 = const guard2(move _13) -> [return: bb11, unwind: bb1]; +// _12 = const guard2(move _13) -> [return: bb12, unwind: bb1]; // } -// bb11: { // end of guard2 +// bb12: { // end of guard2 // StorageDead(_13); -// switchInt(move _12) -> [false: bb13, otherwise: bb12]; +// switchInt(move _12) -> [false: bb14, otherwise: bb13]; // } -// bb12: { // binding4 & arm4 +// bb13: { // binding4 & arm4 // StorageDead(_12); // FakeRead(ForMatchGuard, _5); // FakeRead(ForGuardBinding, _11); @@ -259,17 +266,10 @@ fn main() { // StorageDead(_11); // goto -> bb15; // } -// bb13: { +// bb14: { // StorageDead(_12); // StorageDead(_11); -// falseEdges -> [real: bb14, imaginary: bb14]; -// } -// bb14: { -// StorageLive(_14); -// _14 = _2; -// _1 = const 4i32; -// StorageDead(_14); -// goto -> bb15; +// falseEdges -> [real: bb4, imaginary: bb4]; // } // bb15: { // StorageDead(_2); diff --git a/src/test/mir-opt/match_test.rs b/src/test/mir-opt/match_test.rs index 1ca75b10041..5ee3e1447d8 100644 --- a/src/test/mir-opt/match_test.rs +++ b/src/test/mir-opt/match_test.rs @@ -20,35 +20,35 @@ fn main() { // START rustc.main.SimplifyCfg-initial.after.mir // bb0: { // ... -// switchInt(move _6) -> [false: bb6, otherwise: bb5]; +// switchInt(move _6) -> [false: bb4, otherwise: bb1]; // } // bb1: { -// falseEdges -> [real: bb9, imaginary: bb2]; +// _7 = Lt(_1, const 10i32); +// switchInt(move _7) -> [false: bb4, otherwise: bb2]; // } // bb2: { -// falseEdges -> [real: bb12, imaginary: bb3]; +// falseEdges -> [real: bb9, imaginary: bb6]; // } // bb3: { -// falseEdges -> [real: bb13, imaginary: bb4]; -// } -// bb4: { // _3 = const 3i32; // goto -> bb14; // } +// bb4: { +// _4 = Le(const 10i32, _1); +// switchInt(move _4) -> [false: bb7, otherwise: bb5]; +// } // bb5: { -// _7 = Lt(_1, const 10i32); -// switchInt(move _7) -> [false: bb6, otherwise: bb1]; +// _5 = Le(_1, const 20i32); +// switchInt(move _5) -> [false: bb7, otherwise: bb6]; // } // bb6: { -// _4 = Le(const 10i32, _1); -// switchInt(move _4) -> [false: bb8, otherwise: bb7]; +// falseEdges -> [real: bb12, imaginary: bb8]; // } // bb7: { -// _5 = Le(_1, const 20i32); -// switchInt(move _5) -> [false: bb8, otherwise: bb2]; +// switchInt(_1) -> [-1i32: bb8, otherwise: bb3]; // } // bb8: { -// switchInt(_1) -> [-1i32: bb3, otherwise: bb4]; +// falseEdges -> [real: bb13, imaginary: bb3]; // } // bb9: { // _8 = &shallow _1; @@ -64,7 +64,7 @@ fn main() { // } // bb11: { // StorageDead(_9); -// falseEdges -> [real: bb4, imaginary: bb2]; +// falseEdges -> [real: bb3, imaginary: bb6]; // } // bb12: { // _3 = const 1i32; diff --git a/src/test/mir-opt/remove_fake_borrows.rs b/src/test/mir-opt/remove_fake_borrows.rs index 965897ad541..294fe247c38 100644 --- a/src/test/mir-opt/remove_fake_borrows.rs +++ b/src/test/mir-opt/remove_fake_borrows.rs @@ -19,17 +19,17 @@ fn main() { // bb0: { // FakeRead(ForMatchedPlace, _1); // _3 = discriminant(_1); -// switchInt(move _3) -> [1isize: bb3, otherwise: bb2]; +// switchInt(move _3) -> [1isize: bb2, otherwise: bb1]; // } // bb1: { -// goto -> bb4; -// } -// bb2: { // _0 = const 1i32; // goto -> bb7; // } +// bb2: { +// switchInt((*(*((_1 as Some).0: &' &' i32)))) -> [0i32: bb3, otherwise: bb1]; +// } // bb3: { -// switchInt((*(*((_1 as Some).0: &' &' i32)))) -> [0i32: bb1, otherwise: bb2]; +// goto -> bb4; // } // bb4: { // _4 = &shallow _1; @@ -51,7 +51,7 @@ fn main() { // } // bb6: { // StorageDead(_8); -// goto -> bb2; +// goto -> bb1; // } // bb7: { // return; @@ -65,17 +65,17 @@ fn main() { // bb0: { // nop; // _3 = discriminant(_1); -// switchInt(move _3) -> [1isize: bb3, otherwise: bb2]; +// switchInt(move _3) -> [1isize: bb2, otherwise: bb1]; // } // bb1: { -// goto -> bb4; -// } -// bb2: { // _0 = const 1i32; // goto -> bb7; // } +// bb2: { +// switchInt((*(*((_1 as Some).0: &' &' i32)))) -> [0i32: bb3, otherwise: bb1]; +// } // bb3: { -// switchInt((*(*((_1 as Some).0: &' &' i32)))) -> [0i32: bb1, otherwise: bb2]; +// goto -> bb4; // } // bb4: { // nop; @@ -97,7 +97,7 @@ fn main() { // } // bb6: { // StorageDead(_8); -// goto -> bb2; +// goto -> bb1; // } // bb7: { // return; diff --git a/src/test/mir-opt/simplify_try.rs b/src/test/mir-opt/simplify_try.rs index d85eff45b49..abac66d95c5 100644 --- a/src/test/mir-opt/simplify_try.rs +++ b/src/test/mir-opt/simplify_try.rs @@ -47,22 +47,22 @@ fn main() { // } // bb0: { // _5 = discriminant(_1); -// switchInt(move _5) -> [0isize: bb3, otherwise: bb1]; +// switchInt(move _5) -> [0isize: bb1, otherwise: bb2]; // } // bb1: { -// _6 = ((_1 as Err).0: i32); -// ((_0 as Err).0: i32) = move _6; -// discriminant(_0) = 1; -// goto -> bb2; -// } -// bb2: { -// return; -// } -// bb3: { // _10 = ((_1 as Ok).0: u32); // ((_0 as Ok).0: u32) = move _10; // discriminant(_0) = 0; -// goto -> bb2; +// goto -> bb3; +// } +// bb2: { +// _6 = ((_1 as Err).0: i32); +// ((_0 as Err).0: i32) = move _6; +// discriminant(_0) = 1; +// goto -> bb3; +// } +// bb3: { +// return; // } // } // END rustc.try_identity.SimplifyArmIdentity.before.mir @@ -106,22 +106,22 @@ fn main() { // } // bb0: { // _5 = discriminant(_1); -// switchInt(move _5) -> [0isize: bb3, otherwise: bb1]; +// switchInt(move _5) -> [0isize: bb1, otherwise: bb2]; // } // bb1: { // _0 = move _1; // nop; // nop; -// goto -> bb2; +// goto -> bb3; // } // bb2: { -// return; -// } -// bb3: { // _0 = move _1; // nop; // nop; -// goto -> bb2; +// goto -> bb3; +// } +// bb3: { +// return; // } // } // END rustc.try_identity.SimplifyArmIdentity.after.mir @@ -165,16 +165,16 @@ fn main() { // } // bb0: { // _5 = discriminant(_1); -// goto -> bb2; +// goto -> bb1; // } // bb1: { -// return; -// } -// bb2: { // _0 = move _1; // nop; // nop; -// goto -> bb1; +// goto -> bb2; +// } +// bb2: { +// return; // } // } // END rustc.try_identity.SimplifyBranchSame.after.mir diff --git a/src/test/ui/consts/const_let_refutable.rs b/src/test/ui/consts/const_let_refutable.rs index d48d5945e7d..e49d4767391 100644 --- a/src/test/ui/consts/const_let_refutable.rs +++ b/src/test/ui/consts/const_let_refutable.rs @@ -1,7 +1,7 @@ fn main() {} -const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument - a + b //~ ERROR can only call other `const fn` within a `const fn` - //~^ ERROR use of possibly-uninitialized variable: `a` - //~| ERROR use of possibly-uninitialized variable: `b` +const fn slice(&[a, b]: &[i32]) -> i32 { + //~^ ERROR refutable pattern in function argument + //~| ERROR loops and conditional expressions are not stable in const fn + a + b } diff --git a/src/test/ui/consts/const_let_refutable.stderr b/src/test/ui/consts/const_let_refutable.stderr index 9acb4ad9cbb..719e14005ff 100644 --- a/src/test/ui/consts/const_let_refutable.stderr +++ b/src/test/ui/consts/const_let_refutable.stderr @@ -1,31 +1,19 @@ error[E0005]: refutable pattern in function argument: `&[]`, `&[_]` and `&[_, _, _, ..]` not covered --> $DIR/const_let_refutable.rs:3:16 | -LL | const fn slice([a, b]: &[i32]) -> i32 { - | ^^^^^^ patterns `&[]`, `&[_]` and `&[_, _, _, ..]` not covered +LL | const fn slice(&[a, b]: &[i32]) -> i32 { + | ^^^^^^^ patterns `&[]`, `&[_]` and `&[_, _, _, ..]` not covered -error[E0723]: can only call other `const fn` within a `const fn`, but `const <&i32 as std::ops::Add>::add` is not stable as `const fn` - --> $DIR/const_let_refutable.rs:4:5 +error[E0723]: loops and conditional expressions are not stable in const fn + --> $DIR/const_let_refutable.rs:3:17 | -LL | a + b - | ^^^^^ +LL | const fn slice(&[a, b]: &[i32]) -> i32 { + | ^^^^^^ | = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563 = help: add `#![feature(const_fn)]` to the crate attributes to enable -error[E0381]: use of possibly-uninitialized variable: `a` - --> $DIR/const_let_refutable.rs:4:5 - | -LL | a + b - | ^ use of possibly-uninitialized `a` +error: aborting due to 2 previous errors -error[E0381]: use of possibly-uninitialized variable: `b` - --> $DIR/const_let_refutable.rs:4:9 - | -LL | a + b - | ^ use of possibly-uninitialized `b` - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0005, E0381, E0723. +Some errors have detailed explanations: E0005, E0723. For more information about an error, try `rustc --explain E0005`. diff --git a/src/test/ui/empty/empty-never-array.rs b/src/test/ui/empty/empty-never-array.rs index f0ecea42f39..01b99134a44 100644 --- a/src/test/ui/empty/empty-never-array.rs +++ b/src/test/ui/empty/empty-never-array.rs @@ -10,7 +10,6 @@ fn transmute(t: T) -> U { let Helper::U(u) = Helper::T(t, []); //~^ ERROR refutable pattern in local binding: `T(_, _)` not covered u - //~^ ERROR use of possibly-uninitialized variable: `u` } fn main() { diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr index d865b59f0b9..a4ffceea4c9 100644 --- a/src/test/ui/empty/empty-never-array.stderr +++ b/src/test/ui/empty/empty-never-array.stderr @@ -19,13 +19,6 @@ help: you might want to use `if let` to ignore the variant that isn't matched LL | if let Helper::U(u) = Helper::T(t, []) { /* */ } | -error[E0381]: use of possibly-uninitialized variable: `u` - --> $DIR/empty-never-array.rs:12:5 - | -LL | u - | ^ use of possibly-uninitialized `u` +error: aborting due to previous error -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0005, E0381. -For more information about an error, try `rustc --explain E0005`. +For more information about this error, try `rustc --explain E0005`. diff --git a/src/test/ui/issues/issue-12567.stderr b/src/test/ui/issues/issue-12567.stderr index 2a88d8f0524..3ce659ccd14 100644 --- a/src/test/ui/issues/issue-12567.stderr +++ b/src/test/ui/issues/issue-12567.stderr @@ -1,17 +1,3 @@ -error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:2:11 - | -LL | match (l1, l2) { - | ^^^^^^^^ cannot move out of here -... -LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) - | -- data moved here -LL | => println!("one empty"), -LL | (&[hd1, ..], &[hd2, ..]) - | --- ...and here - | - = note: move occurs because these variables have types that don't implement the `Copy` trait - error[E0508]: cannot move out of type `[T]`, a non-copy slice --> $DIR/issue-12567.rs:2:11 | @@ -26,6 +12,20 @@ LL | (&[hd1, ..], &[hd2, ..]) | = note: move occurs because these variables have types that don't implement the `Copy` trait +error[E0508]: cannot move out of type `[T]`, a non-copy slice + --> $DIR/issue-12567.rs:2:11 + | +LL | match (l1, l2) { + | ^^^^^^^^ cannot move out of here +... +LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) + | -- data moved here +LL | => println!("one empty"), +LL | (&[hd1, ..], &[hd2, ..]) + | --- ...and here + | + = note: move occurs because these variables have types that don't implement the `Copy` trait + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0508`. diff --git a/src/test/ui/issues/issue-15381.rs b/src/test/ui/issues/issue-15381.rs index 5307153cb44..392fb1b24dd 100644 --- a/src/test/ui/issues/issue-15381.rs +++ b/src/test/ui/issues/issue-15381.rs @@ -4,6 +4,5 @@ fn main() { for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { //~^ ERROR refutable pattern in `for` loop binding: `&[]`, `&[_]`, `&[_, _]` and 1 more not println!("y={}", y); - //~^ ERROR borrow of possibly-uninitialized variable: `y` } } diff --git a/src/test/ui/issues/issue-15381.stderr b/src/test/ui/issues/issue-15381.stderr index 47a0d514ad8..35f46ab5727 100644 --- a/src/test/ui/issues/issue-15381.stderr +++ b/src/test/ui/issues/issue-15381.stderr @@ -4,13 +4,6 @@ error[E0005]: refutable pattern in `for` loop binding: `&[]`, `&[_]`, `&[_, _]` LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { | ^^^^^^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 1 more not covered -error[E0381]: borrow of possibly-uninitialized variable: `y` - --> $DIR/issue-15381.rs:6:26 - | -LL | println!("y={}", y); - | ^ use of possibly-uninitialized `y` +error: aborting due to previous error -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0005, E0381. -For more information about an error, try `rustc --explain E0005`. +For more information about this error, try `rustc --explain E0005`. diff --git a/src/test/ui/or-patterns/consistent-bindings.rs b/src/test/ui/or-patterns/consistent-bindings.rs index ec71afed872..3ee57978bb0 100644 --- a/src/test/ui/or-patterns/consistent-bindings.rs +++ b/src/test/ui/or-patterns/consistent-bindings.rs @@ -2,6 +2,8 @@ // edition:2018 +// check-pass + #![feature(or_patterns)] fn main() { @@ -11,35 +13,29 @@ fn main() { let Ok(ref mut a) | Err(ref mut a) = Ok(0); // Two levels: - enum Tri { V1(S), V2(T), V3(U) } + enum Tri { + V1(S), + V2(T), + V3(U), + } use Tri::*; - let Ok((V1(a) | V2(a) | V3(a), b)) | Err(Ok((a, b)) | Err((a, b))) - : Result<_, Result<_, _>> - = Ok((V1(1), 1)); + let Ok((V1(a) | V2(a) | V3(a), b)) | Err(Ok((a, b)) | Err((a, b))): Result<_, Result<_, _>> = + Ok((V1(1), 1)); - let Ok((V1(a) | V2(a) | V3(a), ref b)) | Err(Ok((a, ref b)) | Err((a, ref b))) - : Result<_, Result<_, _>> - = Ok((V1(1), 1)); + let Ok((V1(a) | V2(a) | V3(a), ref b)) | Err(Ok((a, ref b)) | Err((a, ref b))): Result< + _, + Result<_, _>, + > = Ok((V1(1), 1)); // Three levels: let ( - a, - Err((ref mut b, ref c, d)) | - Ok(( - Ok( - V1((ref c, d)) | - V2((d, ref c)) | - V3((ref c, Ok((_, d)) | Err((d, _)))) - ) | - Err((ref c, d)), - ref mut b - )) - ) = - (1, Ok((Ok(V3((1, Ok((1, 1))))), 1))); - - // FIXME(or_patterns; Centril | dlrobertson): remove this line below and - // change this test to check-pass once MIR can handle or-patterns with bindings. - let () = 0; - //~^ ERROR mismatched types + a, + Err((ref mut b, ref c, d)) + | Ok(( + Ok(V1((ref c, d)) | V2((d, ref c)) | V3((ref c, Ok((_, d)) | Err((d, _))))) + | Err((ref c, d)), + ref mut b, + )), + ): (_, Result<_, _>) = (1, Ok((Ok(V3((1, Ok::<_, (i32, i32)>((1, 1))))), 1))); } diff --git a/src/test/ui/or-patterns/consistent-bindings.stderr b/src/test/ui/or-patterns/consistent-bindings.stderr deleted file mode 100644 index bb8e90af5f2..00000000000 --- a/src/test/ui/or-patterns/consistent-bindings.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/consistent-bindings.rs:43:9 - | -LL | let () = 0; - | ^^ expected integer, found `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs index 2e8baf978e2..c8bc4a2a8d5 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs @@ -1,13 +1,8 @@ #![feature(or_patterns)] #![deny(unreachable_patterns)] -// We wrap patterns in a tuple because top-level or-patterns are special-cased for now. +// We wrap patterns in a tuple because top-level or-patterns were special-cased. fn main() { - // Get the fatal error out of the way - match (0u8,) { - (0 | _,) => {} //~^ ERROR or-patterns are not fully implemented yet - } - match (0u8, 0u8) { //~^ ERROR non-exhaustive patterns: `(2u8..=std::u8::MAX, _)` (0 | 1, 2 | 3) => {} diff --git a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr index 7fbd846a22f..3ba26de10d3 100644 --- a/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `(2u8..=std::u8::MAX, _)` not covered - --> $DIR/exhaustiveness-non-exhaustive.rs:13:11 + --> $DIR/exhaustiveness-non-exhaustive.rs:6:11 | LL | match (0u8, 0u8) { | ^^^^^^^^^^ pattern `(2u8..=std::u8::MAX, _)` not covered @@ -7,7 +7,7 @@ LL | match (0u8, 0u8) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((4u8..=std::u8::MAX))` not covered - --> $DIR/exhaustiveness-non-exhaustive.rs:17:11 + --> $DIR/exhaustiveness-non-exhaustive.rs:10:11 | LL | match ((0u8,),) { | ^^^^^^^^^ pattern `((4u8..=std::u8::MAX))` not covered @@ -15,19 +15,13 @@ LL | match ((0u8,),) { = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(Some(2u8..=std::u8::MAX))` not covered - --> $DIR/exhaustiveness-non-exhaustive.rs:21:11 + --> $DIR/exhaustiveness-non-exhaustive.rs:14:11 | LL | match (Some(0u8),) { | ^^^^^^^^^^^^ pattern `(Some(2u8..=std::u8::MAX))` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms -error: or-patterns are not fully implemented yet - --> $DIR/exhaustiveness-non-exhaustive.rs:9:10 - | -LL | (0 | _,) => {} - | ^^^^^ - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/or-patterns/exhaustiveness-pass.rs b/src/test/ui/or-patterns/exhaustiveness-pass.rs index 9b62810d29d..8dcf8792f6f 100644 --- a/src/test/ui/or-patterns/exhaustiveness-pass.rs +++ b/src/test/ui/or-patterns/exhaustiveness-pass.rs @@ -1,13 +1,10 @@ #![feature(or_patterns)] #![deny(unreachable_patterns)] -// We wrap patterns in a tuple because top-level or-patterns are special-cased for now. -fn main() { - // Get the fatal error out of the way - match (0,) { - (0 | _,) => {} //~^ ERROR or-patterns are not fully implemented yet - } +// check-pass +// We wrap patterns in a tuple because top-level or-patterns were special-cased. +fn main() { match (0,) { (1 | 2,) => {} _ => {} diff --git a/src/test/ui/or-patterns/exhaustiveness-pass.stderr b/src/test/ui/or-patterns/exhaustiveness-pass.stderr deleted file mode 100644 index dc5a4186ac7..00000000000 --- a/src/test/ui/or-patterns/exhaustiveness-pass.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: or-patterns are not fully implemented yet - --> $DIR/exhaustiveness-pass.rs:9:10 - | -LL | (0 | _,) => {} - | ^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs index dd1c16f5000..44bae282d88 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.rs @@ -1,13 +1,8 @@ #![feature(or_patterns)] #![deny(unreachable_patterns)] -// We wrap patterns in a tuple because top-level or-patterns are special-cased for now. +// We wrap patterns in a tuple because top-level or-patterns were special-cased. fn main() { - // Get the fatal error out of the way - match (0u8,) { - (0 | _,) => {} //~^ ERROR or-patterns are not fully implemented yet - } - match (0u8,) { (1 | 2,) => {} (1,) => {} //~ ERROR unreachable pattern diff --git a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr index 1f07c27afad..bef6f8270bc 100644 --- a/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr +++ b/src/test/ui/or-patterns/exhaustiveness-unreachable-pattern.stderr @@ -1,110 +1,104 @@ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:15:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:8:9 | LL | (1,) => {} | ^^^^ | note: the lint level is defined here - --> $DIR/exhaustiveness-unreachable-pattern.rs:3:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:2:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:20:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:13:9 | LL | (2,) => {} | ^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:26:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:19:9 | LL | (1 | 2,) => {} | ^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:31:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:24:9 | LL | (1, 3) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:32:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:25:9 | LL | (1, 4) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:33:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:26:9 | LL | (2, 4) => {} | ^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:34:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:27:9 | LL | (2 | 1, 4) => {} | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:36:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:29:9 | LL | (1, 4 | 5) => {} | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:41:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:34:9 | LL | (Some(1),) => {} | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:42:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:35:9 | LL | (None,) => {} | ^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:47:9 + --> $DIR/exhaustiveness-unreachable-pattern.rs:40:9 | -LL | ((1..=4,),) => {}, +LL | ((1..=4,),) => {} | ^^^^^^^^^^^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:53:12 + --> $DIR/exhaustiveness-unreachable-pattern.rs:45:14 | -LL | | 1,) => {} - | ^ +LL | (1 | 1,) => {} + | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:60:15 + --> $DIR/exhaustiveness-unreachable-pattern.rs:52:15 | LL | | 0] => {} | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:58:15 + --> $DIR/exhaustiveness-unreachable-pattern.rs:50:15 | LL | | 0 | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:68:10 + --> $DIR/exhaustiveness-unreachable-pattern.rs:60:10 | LL | [1 | ^ error: unreachable pattern - --> $DIR/exhaustiveness-unreachable-pattern.rs:74:14 + --> $DIR/exhaustiveness-unreachable-pattern.rs:66:14 | LL | Some(0 | ^ -error: or-patterns are not fully implemented yet - --> $DIR/exhaustiveness-unreachable-pattern.rs:9:10 - | -LL | (0 | _,) => {} - | ^^^^^ - -error: aborting due to 17 previous errors +error: aborting due to 16 previous errors diff --git a/src/test/ui/or-patterns/feature-gate-const-fn.rs b/src/test/ui/or-patterns/feature-gate-const-fn.rs index d21cf3dc72c..2ef5537db60 100644 --- a/src/test/ui/or-patterns/feature-gate-const-fn.rs +++ b/src/test/ui/or-patterns/feature-gate-const-fn.rs @@ -30,6 +30,8 @@ fn main() { let x = Ok(3); let Ok(y) | Err(y) = x; //~^ ERROR or-pattern is not allowed in a `const` + //~| ERROR constant contains unimplemented expression type + //~| ERROR constant contains unimplemented expression type 2 }]; } diff --git a/src/test/ui/or-patterns/feature-gate-const-fn.stderr b/src/test/ui/or-patterns/feature-gate-const-fn.stderr index 112bc625172..9284e2d442d 100644 --- a/src/test/ui/or-patterns/feature-gate-const-fn.stderr +++ b/src/test/ui/or-patterns/feature-gate-const-fn.stderr @@ -52,6 +52,19 @@ LL | let Ok(y) | Err(y) = x; = note: for more information, see https://github.com/rust-lang/rust/issues/49146 = help: add `#![feature(const_if_match)]` to the crate attributes to enable -error: aborting due to 6 previous errors +error[E0019]: constant contains unimplemented expression type + --> $DIR/feature-gate-const-fn.rs:31:25 + | +LL | let Ok(y) | Err(y) = x; + | ^ -For more information about this error, try `rustc --explain E0658`. +error[E0019]: constant contains unimplemented expression type + --> $DIR/feature-gate-const-fn.rs:31:16 + | +LL | let Ok(y) | Err(y) = x; + | ^ + +error: aborting due to 8 previous errors + +Some errors have detailed explanations: E0019, E0658. +For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs b/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs index f6b317886bf..44893036383 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs @@ -6,7 +6,6 @@ fn foo(res: Result) -> u32 { let Ok(x) = res; //~^ ERROR refutable pattern x - //~^ ERROR use of possibly-uninitialized variable: `x` } fn main() { diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr index f9ae75b1831..aa23aed4b42 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -11,13 +11,6 @@ help: you might want to use `if let` to ignore the variant that isn't matched LL | if let Ok(x) = res { /* */ } | -error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/recursive-types-are-not-uninhabited.rs:8:5 - | -LL | x - | ^ use of possibly-uninitialized `x` +error: aborting due to previous error -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0005, E0381. -For more information about an error, try `rustc --explain E0005`. +For more information about this error, try `rustc --explain E0005`. diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr index 1f1211aa198..612fae208cc 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr @@ -65,13 +65,18 @@ LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | &(Either::One(_t), Either::Two(_u)) - | ----------------------------------- - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` + | -- -- ...and here + | | + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the `&` + | +LL | (Either::One(_t), Either::Two(_u)) +LL | +LL | +LL | | &(Either::Two(_t), Either::One(_u)) => (), + | error[E0507]: cannot move out of a shared reference --> $DIR/duplicate-suggestions.rs:70:11 @@ -170,13 +175,18 @@ LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | &mut (Either::One(_t), Either::Two(_u)) - | --------------------------------------- - | | | | - | | | ...and here - | | data moved here - | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` + | -- -- ...and here + | | + | data moved here | = note: move occurs because these variables have types that don't implement the `Copy` trait +help: consider removing the `&mut` + | +LL | (Either::One(_t), Either::Two(_u)) +LL | +LL | +LL | | &mut (Either::Two(_t), Either::One(_u)) => (), + | error[E0507]: cannot move out of a mutable reference --> $DIR/duplicate-suggestions.rs:122:11 diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr index ac91ac43736..5550e097cf5 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr @@ -263,11 +263,18 @@ LL | match r { | ^ LL | LL | &Either::One(_t) - | ---------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the `&` + | +LL | Either::One(_t) +LL | +LL | +LL | | &Either::Two(_t) => (), + | error[E0507]: cannot move out of `r.0` which is behind a shared reference --> $DIR/simple.rs:188:11 @@ -502,11 +509,18 @@ LL | match &e { | ^^ LL | LL | &Either::One(_t) - | ---------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the `&` + | +LL | Either::One(_t) +LL | +LL | +LL | | &Either::Two(_t) => (), + | error[E0507]: cannot move out of a shared reference --> $DIR/simple.rs:308:11 @@ -571,11 +585,18 @@ LL | match &mut em { | ^^^^^^^ LL | LL | &mut Either::One(_t) - | -------------------- - | | | - | | data moved here - | | move occurs because `_t` has type `X`, which does not implement the `Copy` trait - | help: consider removing the `&mut`: `Either::One(_t)` + | -- + | | + | data moved here + | move occurs because `_t` has type `X`, which does not implement the `Copy` trait + | +help: consider removing the `&mut` + | +LL | Either::One(_t) +LL | +LL | +LL | | &mut Either::Two(_t) => (), + | error[E0507]: cannot move out of a mutable reference --> $DIR/simple.rs:343:11