From 99468bb7609ad5f598ef105860ceb32bc1b95074 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 27 Jul 2024 11:08:16 +0200 Subject: [PATCH] Update tests --- ...atterns.opt1.SimplifyCfg-initial.after.mir | 10 +- ...atterns.opt2.SimplifyCfg-initial.after.mir | 15 - ...atterns.opt3.SimplifyCfg-initial.after.mir | 17 +- ...ch.UnreachablePropagation.panic-abort.diff | 16 +- ...h.UnreachablePropagation.panic-unwind.diff | 16 +- tests/mir-opt/unreachable.rs | 10 +- tests/mir-opt/unreachable_enum_branching.rs | 2 +- ....UnreachableEnumBranching.panic-abort.diff | 28 +- ...UnreachableEnumBranching.panic-unwind.diff | 28 +- .../run_pass/multivariant.rs | 3 +- .../huge_multispan_highlight.svg | 2 +- .../write-to-uninhabited-enum-variant.rs | 4 +- tests/ui/enum-discriminant/issue-61696.rs | 1 + tests/ui/enum-discriminant/niche.rs | 1 + .../feature-gate-exhaustive-patterns.rs | 2 +- .../feature-gate-exhaustive-patterns.stderr | 10 +- tests/ui/never_type/never-result.rs | 5 +- ...bited-union-ref.exhaustive_patterns.stderr | 6 +- ... always-inhabited-union-ref.normal.stderr} | 6 +- .../usefulness/always-inhabited-union-ref.rs | 3 +- ...tch-check-notes.exhaustive_patterns.stderr | 6 +- .../empty-match-check-notes.normal.stderr | 7 +- .../usefulness/empty-match-check-notes.rs | 6 +- .../empty-match.exhaustive_patterns.stderr | 1 + .../usefulness/empty-match.normal.stderr | 1 + .../empty-types.exhaustive_patterns.stderr | 152 +++---- .../usefulness/empty-types.never_pats.stderr | 397 ++++++++++-------- .../usefulness/empty-types.normal.stderr | 395 +++++++++-------- tests/ui/pattern/usefulness/empty-types.rs | 91 ++-- .../usefulness/explain-unreachable-pats.rs | 1 - .../explain-unreachable-pats.stderr | 24 +- tests/ui/pattern/usefulness/impl-trait.rs | 1 - tests/ui/pattern/usefulness/impl-trait.stderr | 32 +- ...privately-empty.exhaustive_patterns.stderr | 2 +- .../match-privately-empty.normal.stderr | 21 + .../usefulness/match-privately-empty.rs | 3 +- .../slice_of_empty.exhaustive_patterns.stderr | 2 +- .../usefulness/slice_of_empty.normal.stderr | 30 ++ tests/ui/pattern/usefulness/slice_of_empty.rs | 7 +- tests/ui/pattern/usefulness/uninhabited.rs | 1 - .../ui/reachable/unreachable-loop-patterns.rs | 2 - .../unreachable-loop-patterns.stderr | 4 +- .../ui/rfcs/rfc-0000-never_patterns/check.rs | 8 +- .../rfcs/rfc-0000-never_patterns/check.stderr | 22 +- .../typeck.fail.stderr | 16 +- .../ui/rfcs/rfc-0000-never_patterns/typeck.rs | 1 - .../unreachable.exh_pats.stderr | 14 +- .../unreachable.normal.stderr | 44 ++ .../rfc-0000-never_patterns/unreachable.rs | 15 +- .../unreachable.stderr | 55 +++ .../uninhabited/indirect_match_same_crate.rs | 11 +- .../indirect_match_same_crate.stderr | 79 ---- ...indirect_match_with_exhaustive_patterns.rs | 1 - ...rect_match_with_exhaustive_patterns.stderr | 8 +- ...tch_with_exhaustive_patterns_same_crate.rs | 1 - .../uninhabited/match_same_crate.rs | 7 +- .../uninhabited/match_same_crate.stderr | 64 --- .../match_with_exhaustive_patterns.rs | 1 - .../match_with_exhaustive_patterns.stderr | 8 +- ...tch_with_exhaustive_patterns_same_crate.rs | 1 - .../uninhabited/patterns.rs | 1 - .../uninhabited/patterns_same_crate.rs | 1 - .../uninhabited/patterns_same_crate.stderr | 10 +- tests/ui/try-trait/try-operator-custom.rs | 3 - .../exhaustive-wo-nevertype-issue-51221.rs | 2 - ...ted-irrefutable.exhaustive_patterns.stderr | 4 +- .../uninhabited-irrefutable.normal.stderr | 26 ++ .../ui/uninhabited/uninhabited-irrefutable.rs | 3 +- .../uninhabited-matches-feature-gated.rs | 7 +- .../uninhabited-matches-feature-gated.stderr | 66 +-- tests/ui/uninhabited/uninhabited-patterns.rs | 1 - .../uninhabited/uninhabited-patterns.stderr | 8 +- 72 files changed, 948 insertions(+), 911 deletions(-) rename tests/ui/pattern/usefulness/{always-inhabited-union-ref.min_exhaustive_patterns.stderr => always-inhabited-union-ref.normal.stderr} (87%) create mode 100644 tests/ui/pattern/usefulness/match-privately-empty.normal.stderr create mode 100644 tests/ui/pattern/usefulness/slice_of_empty.normal.stderr create mode 100644 tests/ui/rfcs/rfc-0000-never_patterns/unreachable.normal.stderr create mode 100644 tests/ui/rfcs/rfc-0000-never_patterns/unreachable.stderr delete mode 100644 tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_same_crate.stderr delete mode 100644 tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_same_crate.stderr create mode 100644 tests/ui/uninhabited/uninhabited-irrefutable.normal.stderr diff --git a/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir index 78356a90743..bba4d9c0149 100644 --- a/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir @@ -13,17 +13,17 @@ fn opt1(_1: &Result) -> &u32 { bb0: { PlaceMention(_1); - _2 = discriminant((*_1)); - switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; + falseEdge -> [real: bb4, imaginary: bb1]; } bb1: { - FakeRead(ForMatchedPlace(None), _1); - unreachable; + _2 = discriminant((*_1)); + switchInt(move _2) -> [1: bb3, otherwise: bb2]; } bb2: { - falseEdge -> [real: bb4, imaginary: bb3]; + FakeRead(ForMatchedPlace(None), _1); + unreachable; } bb3: { diff --git a/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir index 979fbb2860d..fc0769d6f7d 100644 --- a/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir @@ -11,25 +11,10 @@ fn opt2(_1: &Result) -> &u32 { bb0: { PlaceMention(_1); - _2 = discriminant((*_1)); - switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; - } - - bb1: { - FakeRead(ForMatchedPlace(None), _1); - unreachable; - } - - bb2: { StorageLive(_3); _3 = &(((*_1) as Ok).0: u32); _0 = &(*_3); StorageDead(_3); return; } - - bb3: { - FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void)); - unreachable; - } } diff --git a/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir b/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir index 93ebe600b3f..86347db4d92 100644 --- a/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir +++ b/tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir @@ -12,24 +12,19 @@ fn opt3(_1: &Result) -> &u32 { bb0: { PlaceMention(_1); _2 = discriminant((*_1)); - switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1]; + switchInt(move _2) -> [1: bb2, otherwise: bb1]; } bb1: { - FakeRead(ForMatchedPlace(None), _1); - unreachable; - } - - bb2: { - FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void)); - unreachable; - } - - bb3: { StorageLive(_3); _3 = &(((*_1) as Ok).0: u32); _0 = &(*_3); StorageDead(_3); return; } + + bb2: { + FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void)); + unreachable; + } } diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff index da7a2bd10e0..1e1ddfae0eb 100644 --- a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff +++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff @@ -19,14 +19,16 @@ bb1: { _2 = discriminant(_1); -- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2]; -+ _5 = Eq(_2, const 0_isize); +- switchInt(move _2) -> [1: bb3, otherwise: bb2]; ++ _5 = Ne(_2, const 1_isize); + assume(move _5); -+ goto -> bb4; ++ goto -> bb2; } bb2: { - unreachable; + _0 = const (); + StorageDead(_1); + return; } bb3: { @@ -35,11 +37,5 @@ - StorageLive(_4); unreachable; } - - bb4: { - _0 = const (); - StorageDead(_1); - return; - } } diff --git a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff index a2121fc684f..809d24aa15a 100644 --- a/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff +++ b/tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff @@ -19,14 +19,16 @@ bb1: { _2 = discriminant(_1); -- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2]; -+ _5 = Eq(_2, const 0_isize); +- switchInt(move _2) -> [1: bb3, otherwise: bb2]; ++ _5 = Ne(_2, const 1_isize); + assume(move _5); -+ goto -> bb4; ++ goto -> bb2; } bb2: { - unreachable; + _0 = const (); + StorageDead(_1); + return; } bb3: { @@ -35,11 +37,5 @@ - StorageLive(_4); unreachable; } - - bb4: { - _0 = const (); - StorageDead(_1); - return; - } } diff --git a/tests/mir-opt/unreachable.rs b/tests/mir-opt/unreachable.rs index 881e3542f0a..f7f4815ae7c 100644 --- a/tests/mir-opt/unreachable.rs +++ b/tests/mir-opt/unreachable.rs @@ -45,18 +45,16 @@ fn as_match() { // CHECK: bb0: { // CHECK: {{_.*}} = empty() // CHECK: bb1: { - // CHECK: [[eq:_.*]] = Eq({{.*}}, const 0_isize); + // CHECK: [[eq:_.*]] = Ne({{.*}}, const 1_isize); // CHECK-NEXT: assume(move [[eq]]); - // CHECK-NEXT: goto -> bb4; + // CHECK-NEXT: goto -> bb2; // CHECK: bb2: { - // CHECK-NEXT: unreachable; + // CHECK: return; // CHECK: bb3: { // CHECK-NEXT: unreachable; - // CHECK: bb4: { - // CHECK: return; match empty() { - None => {} Some(_x) => match _x {}, + None => {} } } diff --git a/tests/mir-opt/unreachable_enum_branching.rs b/tests/mir-opt/unreachable_enum_branching.rs index fac14042b10..7647f9bf077 100644 --- a/tests/mir-opt/unreachable_enum_branching.rs +++ b/tests/mir-opt/unreachable_enum_branching.rs @@ -49,7 +49,7 @@ struct Plop { fn simple() { // CHECK-LABEL: fn simple( // CHECK: [[discr:_.*]] = discriminant( - // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb2, otherwise: [[unreachable]]]; + // CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]]; // CHECK: [[unreachable]]: { // CHECK-NEXT: unreachable; match Test1::C { diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff index 8aef9914936..5c08648fac3 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff @@ -14,40 +14,40 @@ StorageLive(_2); _2 = Test1::C; _3 = discriminant(_2); -- switchInt(move _3) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb1]; -+ switchInt(move _3) -> [0: bb1, 1: bb1, 2: bb2, otherwise: bb1]; +- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; ++ switchInt(move _3) -> [0: bb5, 1: bb5, 2: bb1, otherwise: bb5]; } bb1: { - unreachable; - } - - bb2: { StorageLive(_5); _5 = const "C"; _1 = &(*_5); StorageDead(_5); - goto -> bb5; + goto -> bb4; } - bb3: { + bb2: { StorageLive(_4); _4 = const "B(Empty)"; _1 = &(*_4); StorageDead(_4); - goto -> bb5; + goto -> bb4; + } + + bb3: { + _1 = const "A(Empty)"; + goto -> bb4; } bb4: { - _1 = const "A(Empty)"; - goto -> bb5; - } - - bb5: { StorageDead(_2); StorageDead(_1); _0 = const (); return; ++ } ++ ++ bb5: { ++ unreachable; } } diff --git a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff index 8aef9914936..5c08648fac3 100644 --- a/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff +++ b/tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff @@ -14,40 +14,40 @@ StorageLive(_2); _2 = Test1::C; _3 = discriminant(_2); -- switchInt(move _3) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb1]; -+ switchInt(move _3) -> [0: bb1, 1: bb1, 2: bb2, otherwise: bb1]; +- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1]; ++ switchInt(move _3) -> [0: bb5, 1: bb5, 2: bb1, otherwise: bb5]; } bb1: { - unreachable; - } - - bb2: { StorageLive(_5); _5 = const "C"; _1 = &(*_5); StorageDead(_5); - goto -> bb5; + goto -> bb4; } - bb3: { + bb2: { StorageLive(_4); _4 = const "B(Empty)"; _1 = &(*_4); StorageDead(_4); - goto -> bb5; + goto -> bb4; + } + + bb3: { + _1 = const "A(Empty)"; + goto -> bb4; } bb4: { - _1 = const "A(Empty)"; - goto -> bb5; - } - - bb5: { StorageDead(_2); StorageDead(_1); _0 = const (); return; ++ } ++ ++ bb5: { ++ unreachable; } } diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs b/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs index 52ed008137f..74f37b514e4 100644 --- a/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs +++ b/tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs @@ -1,10 +1,9 @@ // Test precise capture of a multi-variant enum (when remaining variants are // visibly uninhabited). -//@ revisions: min_exhaustive_patterns exhaustive_patterns +//@ revisions: normal exhaustive_patterns //@ edition:2021 //@ run-pass #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] -#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))] #![feature(never_type)] pub fn main() { diff --git a/tests/ui/codemap_tests/huge_multispan_highlight.svg b/tests/ui/codemap_tests/huge_multispan_highlight.svg index 7b6dbb17c6f..12058176dc0 100644 --- a/tests/ui/codemap_tests/huge_multispan_highlight.svg +++ b/tests/ui/codemap_tests/huge_multispan_highlight.svg @@ -1,4 +1,4 @@ - +