Closed
Description
Code
The following code snippet demonstrating or-patterns crashes the nightly compiler on the Playground as of 2-2-2020.
#![feature(or_patterns)]
enum MyEnum {
FirstCase(u8),
OtherCase(u16),
}
fn my_fn(x @ (MyEnum::FirstCase(_) | MyEnum::OtherCase(_)): MyEnum) {}
Error
error: internal compiler error: match pairs [MatchPair { place: _1, pattern: Pat { ty: MyEnum, span: src/lib.rs:8:15: 8:58, kind: Or { pats: [Pat { ty: MyEnum, span: src/lib.rs:8:15: 8:35, kind: Variant { adt_def: MyEnum, substs: [], variant_index: 0, subpatterns: [FieldPat { field: field[0], pattern: Pat { ty: u8, span: src/lib.rs:8:33: 8:34, kind: Wild } }] } }, Pat { ty: MyEnum, span: src/lib.rs:8:38: 8:58, kind: Variant { adt_def: MyEnum, substs: [], variant_index: 1, subpatterns: [FieldPat { field: field[0], pattern: Pat { ty: u16, span: src/lib.rs:8:56: 8:57, kind: Wild } }] } }] } } }] remaining after simplifying irrefutable pattern
--> src/lib.rs:8:15
|
8 | fn my_fn(x @ (MyEnum::FirstCase(_) | MyEnum::OtherCase(_)): MyEnum) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:357:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.42.0-nightly (13db6501c 2020-02-01) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: could not compile `playground`.
To learn more, run the command again with --verbose.
Other Information
I understand that or-patterns are incomplete feature, thus errors are expected. But I was told to report this anyway (cc: @estebank).
It's not convenient for me to test locally right now; is it possible to get a backtrace on the Playground?