Skip to content

Commit 99468bb

Browse files
committed
Update tests
1 parent cd40769 commit 99468bb

File tree

72 files changed

+878
-841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+878
-841
lines changed

Diff for: tests/mir-opt/building/match/never_patterns.opt1.SimplifyCfg-initial.after.mir

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ fn opt1(_1: &Result<u32, Void>) -> &u32 {
1313

1414
bb0: {
1515
PlaceMention(_1);
16-
_2 = discriminant((*_1));
17-
switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
16+
falseEdge -> [real: bb4, imaginary: bb1];
1817
}
1918

2019
bb1: {
21-
FakeRead(ForMatchedPlace(None), _1);
22-
unreachable;
20+
_2 = discriminant((*_1));
21+
switchInt(move _2) -> [1: bb3, otherwise: bb2];
2322
}
2423

2524
bb2: {
26-
falseEdge -> [real: bb4, imaginary: bb3];
25+
FakeRead(ForMatchedPlace(None), _1);
26+
unreachable;
2727
}
2828

2929
bb3: {

Diff for: tests/mir-opt/building/match/never_patterns.opt2.SimplifyCfg-initial.after.mir

-15
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,10 @@ fn opt2(_1: &Result<u32, Void>) -> &u32 {
1111

1212
bb0: {
1313
PlaceMention(_1);
14-
_2 = discriminant((*_1));
15-
switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1];
16-
}
17-
18-
bb1: {
19-
FakeRead(ForMatchedPlace(None), _1);
20-
unreachable;
21-
}
22-
23-
bb2: {
2414
StorageLive(_3);
2515
_3 = &(((*_1) as Ok).0: u32);
2616
_0 = &(*_3);
2717
StorageDead(_3);
2818
return;
2919
}
30-
31-
bb3: {
32-
FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void));
33-
unreachable;
34-
}
3520
}

Diff for: tests/mir-opt/building/match/never_patterns.opt3.SimplifyCfg-initial.after.mir

+6-11
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@ fn opt3(_1: &Result<u32, Void>) -> &u32 {
1212
bb0: {
1313
PlaceMention(_1);
1414
_2 = discriminant((*_1));
15-
switchInt(move _2) -> [0: bb3, 1: bb2, otherwise: bb1];
15+
switchInt(move _2) -> [1: bb2, otherwise: bb1];
1616
}
1717

1818
bb1: {
19-
FakeRead(ForMatchedPlace(None), _1);
20-
unreachable;
21-
}
22-
23-
bb2: {
24-
FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void));
25-
unreachable;
26-
}
27-
28-
bb3: {
2919
StorageLive(_3);
3020
_3 = &(((*_1) as Ok).0: u32);
3121
_0 = &(*_3);
3222
StorageDead(_3);
3323
return;
3424
}
25+
26+
bb2: {
27+
FakeRead(ForMatchedPlace(None), (((*_1) as Err).0: Void));
28+
unreachable;
29+
}
3530
}

Diff for: tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-abort.diff

+6-10
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919

2020
bb1: {
2121
_2 = discriminant(_1);
22-
- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2];
23-
+ _5 = Eq(_2, const 0_isize);
22+
- switchInt(move _2) -> [1: bb3, otherwise: bb2];
23+
+ _5 = Ne(_2, const 1_isize);
2424
+ assume(move _5);
25-
+ goto -> bb4;
25+
+ goto -> bb2;
2626
}
2727

2828
bb2: {
29-
unreachable;
29+
_0 = const ();
30+
StorageDead(_1);
31+
return;
3032
}
3133

3234
bb3: {
@@ -35,11 +37,5 @@
3537
- StorageLive(_4);
3638
unreachable;
3739
}
38-
39-
bb4: {
40-
_0 = const ();
41-
StorageDead(_1);
42-
return;
43-
}
4440
}
4541

Diff for: tests/mir-opt/unreachable.as_match.UnreachablePropagation.panic-unwind.diff

+6-10
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919

2020
bb1: {
2121
_2 = discriminant(_1);
22-
- switchInt(move _2) -> [0: bb4, 1: bb3, otherwise: bb2];
23-
+ _5 = Eq(_2, const 0_isize);
22+
- switchInt(move _2) -> [1: bb3, otherwise: bb2];
23+
+ _5 = Ne(_2, const 1_isize);
2424
+ assume(move _5);
25-
+ goto -> bb4;
25+
+ goto -> bb2;
2626
}
2727

2828
bb2: {
29-
unreachable;
29+
_0 = const ();
30+
StorageDead(_1);
31+
return;
3032
}
3133

3234
bb3: {
@@ -35,11 +37,5 @@
3537
- StorageLive(_4);
3638
unreachable;
3739
}
38-
39-
bb4: {
40-
_0 = const ();
41-
StorageDead(_1);
42-
return;
43-
}
4440
}
4541

Diff for: tests/mir-opt/unreachable.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,16 @@ fn as_match() {
4545
// CHECK: bb0: {
4646
// CHECK: {{_.*}} = empty()
4747
// CHECK: bb1: {
48-
// CHECK: [[eq:_.*]] = Eq({{.*}}, const 0_isize);
48+
// CHECK: [[eq:_.*]] = Ne({{.*}}, const 1_isize);
4949
// CHECK-NEXT: assume(move [[eq]]);
50-
// CHECK-NEXT: goto -> bb4;
50+
// CHECK-NEXT: goto -> bb2;
5151
// CHECK: bb2: {
52-
// CHECK-NEXT: unreachable;
52+
// CHECK: return;
5353
// CHECK: bb3: {
5454
// CHECK-NEXT: unreachable;
55-
// CHECK: bb4: {
56-
// CHECK: return;
5755
match empty() {
58-
None => {}
5956
Some(_x) => match _x {},
57+
None => {}
6058
}
6159
}
6260

Diff for: tests/mir-opt/unreachable_enum_branching.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct Plop {
4949
fn simple() {
5050
// CHECK-LABEL: fn simple(
5151
// CHECK: [[discr:_.*]] = discriminant(
52-
// CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb2, otherwise: [[unreachable]]];
52+
// CHECK: switchInt(move [[discr]]) -> [0: [[unreachable:bb.*]], 1: [[unreachable]], 2: bb1, otherwise: [[unreachable]]];
5353
// CHECK: [[unreachable]]: {
5454
// CHECK-NEXT: unreachable;
5555
match Test1::C {

Diff for: tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-abort.diff

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,40 @@
1414
StorageLive(_2);
1515
_2 = Test1::C;
1616
_3 = discriminant(_2);
17-
- switchInt(move _3) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb1];
18-
+ switchInt(move _3) -> [0: bb1, 1: bb1, 2: bb2, otherwise: bb1];
17+
- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
18+
+ switchInt(move _3) -> [0: bb5, 1: bb5, 2: bb1, otherwise: bb5];
1919
}
2020

2121
bb1: {
22-
unreachable;
23-
}
24-
25-
bb2: {
2622
StorageLive(_5);
2723
_5 = const "C";
2824
_1 = &(*_5);
2925
StorageDead(_5);
30-
goto -> bb5;
26+
goto -> bb4;
3127
}
3228

33-
bb3: {
29+
bb2: {
3430
StorageLive(_4);
3531
_4 = const "B(Empty)";
3632
_1 = &(*_4);
3733
StorageDead(_4);
38-
goto -> bb5;
34+
goto -> bb4;
3935
}
4036

41-
bb4: {
37+
bb3: {
4238
_1 = const "A(Empty)";
43-
goto -> bb5;
39+
goto -> bb4;
4440
}
4541

46-
bb5: {
42+
bb4: {
4743
StorageDead(_2);
4844
StorageDead(_1);
4945
_0 = const ();
5046
return;
47+
+ }
48+
+
49+
+ bb5: {
50+
+ unreachable;
5151
}
5252
}
5353

Diff for: tests/mir-opt/unreachable_enum_branching.simple.UnreachableEnumBranching.panic-unwind.diff

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,40 @@
1414
StorageLive(_2);
1515
_2 = Test1::C;
1616
_3 = discriminant(_2);
17-
- switchInt(move _3) -> [0: bb4, 1: bb3, 2: bb2, otherwise: bb1];
18-
+ switchInt(move _3) -> [0: bb1, 1: bb1, 2: bb2, otherwise: bb1];
17+
- switchInt(move _3) -> [0: bb3, 1: bb2, otherwise: bb1];
18+
+ switchInt(move _3) -> [0: bb5, 1: bb5, 2: bb1, otherwise: bb5];
1919
}
2020

2121
bb1: {
22-
unreachable;
23-
}
24-
25-
bb2: {
2622
StorageLive(_5);
2723
_5 = const "C";
2824
_1 = &(*_5);
2925
StorageDead(_5);
30-
goto -> bb5;
26+
goto -> bb4;
3127
}
3228

33-
bb3: {
29+
bb2: {
3430
StorageLive(_4);
3531
_4 = const "B(Empty)";
3632
_1 = &(*_4);
3733
StorageDead(_4);
38-
goto -> bb5;
34+
goto -> bb4;
3935
}
4036

41-
bb4: {
37+
bb3: {
4238
_1 = const "A(Empty)";
43-
goto -> bb5;
39+
goto -> bb4;
4440
}
4541

46-
bb5: {
42+
bb4: {
4743
StorageDead(_2);
4844
StorageDead(_1);
4945
_0 = const ();
5046
return;
47+
+ }
48+
+
49+
+ bb5: {
50+
+ unreachable;
5151
}
5252
}
5353

Diff for: tests/ui/closures/2229_closure_analysis/run_pass/multivariant.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Test precise capture of a multi-variant enum (when remaining variants are
22
// visibly uninhabited).
3-
//@ revisions: min_exhaustive_patterns exhaustive_patterns
3+
//@ revisions: normal exhaustive_patterns
44
//@ edition:2021
55
//@ run-pass
66
#![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))]
7-
#![cfg_attr(min_exhaustive_patterns, feature(min_exhaustive_patterns))]
87
#![feature(never_type)]
98

109
pub fn main() {

Diff for: tests/ui/codemap_tests/huge_multispan_highlight.svg

+1-1
Loading

Diff for: tests/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//@ run-pass
2-
2+
#![allow(unreachable_patterns)]
33
#![allow(dead_code)]
44

5-
enum Empty { }
5+
enum Empty {}
66
enum Test1 {
77
A(u8),
88
B(Empty),

Diff for: tests/ui/enum-discriminant/issue-61696.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ run-pass
2+
#![allow(unreachable_patterns)]
23

34
pub enum Infallible {}
45

Diff for: tests/ui/enum-discriminant/niche.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//@ run-pass
2+
#![allow(unreachable_patterns)]
23

34
//! Make sure that we read and write enum discriminants correctly for corner cases caused
45
//! by layout optimizations.

Diff for: tests/ui/feature-gates/feature-gate-exhaustive-patterns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ fn foo() -> Result<u32, !> {
55
}
66

77
fn main() {
8-
let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding
8+
let Ok(_x) = &foo(); //~ ERROR refutable pattern in local binding
99
}

Diff for: tests/ui/feature-gates/feature-gate-exhaustive-patterns.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error[E0005]: refutable pattern in local binding
22
--> $DIR/feature-gate-exhaustive-patterns.rs:8:9
33
|
4-
LL | let Ok(_x) = foo();
5-
| ^^^^^^ pattern `Err(_)` not covered
4+
LL | let Ok(_x) = &foo();
5+
| ^^^^^^ pattern `&Err(_)` not covered
66
|
77
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
88
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
9-
= note: the matched value is of type `Result<u32, !>`
9+
= note: the matched value is of type `&Result<u32, !>`
1010
help: you might want to use `let else` to handle the variant that isn't matched
1111
|
12-
LL | let Ok(_x) = foo() else { todo!() };
13-
| ++++++++++++++++
12+
LL | let Ok(_x) = &foo() else { todo!() };
13+
| ++++++++++++++++
1414

1515
error: aborting due to 1 previous error
1616

Diff for: tests/ui/never_type/never-result.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
#![allow(unused_variables)]
44
#![allow(unreachable_code)]
5-
5+
#![allow(unreachable_patterns)]
66
// Test that we can extract a ! through pattern matching then use it as several different types.
7-
87
#![feature(never_type)]
98

109
fn main() {
@@ -16,6 +15,6 @@ fn main() {
1615
let w: i32 = y;
1716
let e: String = y;
1817
y
19-
},
18+
}
2019
}
2120
}

Diff for: tests/ui/pattern/usefulness/always-inhabited-union-ref.exhaustive_patterns.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0004]: non-exhaustive patterns: type `&!` is non-empty
2-
--> $DIR/always-inhabited-union-ref.rs:25:11
2+
--> $DIR/always-inhabited-union-ref.rs:24:11
33
|
44
LL | match uninhab_ref() {
55
| ^^^^^^^^^^^^^
@@ -14,13 +14,13 @@ LL + }
1414
|
1515

1616
error[E0004]: non-exhaustive patterns: type `Foo` is non-empty
17-
--> $DIR/always-inhabited-union-ref.rs:29:11
17+
--> $DIR/always-inhabited-union-ref.rs:28:11
1818
|
1919
LL | match uninhab_union() {
2020
| ^^^^^^^^^^^^^^^
2121
|
2222
note: `Foo` defined here
23-
--> $DIR/always-inhabited-union-ref.rs:12:11
23+
--> $DIR/always-inhabited-union-ref.rs:11:11
2424
|
2525
LL | pub union Foo {
2626
| ^^^

0 commit comments

Comments
 (0)