diff options
| -rw-r--r-- | src/librustc_mir/build/matches/test.rs | 8 | ||||
| -rw-r--r-- | src/test/compile-fail/or-patterns.rs | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index 5c2f72c0a06..f534c2a347c 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -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 { .. } => { diff --git a/src/test/compile-fail/or-patterns.rs b/src/test/compile-fail/or-patterns.rs index ba8427045e3..118090c9eb2 100644 --- a/src/test/compile-fail/or-patterns.rs +++ b/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 _ => {} } |
