Skip to content

Commit cdc844e

Browse files
committed
Make the ice a fatal error
1 parent b5ec4d1 commit cdc844e

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/librustc_mir/build/matches/test.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
8484
}
8585
}
8686

87+
PatKind::Or { .. } => {
88+
self.hir.tcx().sess.span_fatal(
89+
match_pair.pattern.span,
90+
"or-patterns are not fully implemented yet"
91+
)
92+
}
93+
8794
PatKind::AscribeUserType { .. } |
8895
PatKind::Array { .. } |
8996
PatKind::Wild |
90-
PatKind::Or { .. } |
9197
PatKind::Binding { .. } |
9298
PatKind::Leaf { .. } |
9399
PatKind::Deref { .. } => {

src/test/compile-fail/or-patterns.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
// should-ice
21
#![feature(or_patterns)]
32
#![feature(slice_patterns)]
43
#![allow(incomplete_features)]
54
#![deny(unreachable_patterns)]
65

7-
// The ice will get removed once or-patterns are correctly implemented
86
fn main() {
97
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
8+
9+
// Get the fatal error out of the way
10+
match (0u8,) {
11+
(0 | _,) => {}
12+
//~^ ERROR or-patterns are not fully implemented yet
13+
}
14+
1015
match (0u8,) {
1116
(1 | 2,) => {}
12-
//~^ ERROR simplifyable pattern found
13-
// This above is the ICE error message
1417
_ => {}
1518
}
1619

0 commit comments

Comments
 (0)