Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make the ice a fatal error
  • Loading branch information
Nadrieril committed Nov 26, 2019
1 parent b5ec4d1 commit cdc844e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/librustc_mir/build/matches/test.rs
Expand Up @@ -84,10 +84,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

PatKind::Or { .. } => {
self.hir.tcx().sess.span_fatal(
match_pair.pattern.span,
"or-patterns are not fully implemented yet"
)
}

PatKind::AscribeUserType { .. } |
PatKind::Array { .. } |
PatKind::Wild |
PatKind::Or { .. } |
PatKind::Binding { .. } |
PatKind::Leaf { .. } |
PatKind::Deref { .. } => {
Expand Down
11 changes: 7 additions & 4 deletions src/test/compile-fail/or-patterns.rs
@@ -1,16 +1,19 @@
// should-ice
#![feature(or_patterns)]
#![feature(slice_patterns)]
#![allow(incomplete_features)]
#![deny(unreachable_patterns)]

// The ice will get removed once or-patterns are correctly implemented
fn main() {
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.

// Get the fatal error out of the way
match (0u8,) {
(0 | _,) => {}
//~^ ERROR or-patterns are not fully implemented yet
}

match (0u8,) {
(1 | 2,) => {}
//~^ ERROR simplifyable pattern found
// This above is the ICE error message
_ => {}
}

Expand Down

0 comments on commit cdc844e

Please sign in to comment.