forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#69753 - pnkfelix:issue-69191-ice-on-uninhab…
…ited-enum-field, r=oli-obk Do not ICE when matching an uninhabited enum's field Fix rust-lang#69191
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/ui/consts/issue-69191-ice-on-uninhabited-enum-field.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// build-pass | ||
// | ||
// (this is deliberately *not* check-pass; I have confirmed that the bug in | ||
// question does not replicate when one uses `cargo check` alone.) | ||
|
||
pub enum Void {} | ||
|
||
enum UninhabitedUnivariant { _Variant(Void), } | ||
|
||
#[repr(C)] | ||
enum UninhabitedUnivariantC { _Variant(Void), } | ||
|
||
#[repr(i32)] | ||
enum UninhabitedUnivariant32 { _Variant(Void), } | ||
|
||
fn main() { | ||
let _seed: UninhabitedUnivariant = None.unwrap(); | ||
match _seed { | ||
UninhabitedUnivariant::_Variant(_x) => {} | ||
} | ||
|
||
let _seed: UninhabitedUnivariantC = None.unwrap(); | ||
match _seed { | ||
UninhabitedUnivariantC::_Variant(_x) => {} | ||
} | ||
|
||
let _seed: UninhabitedUnivariant32 = None.unwrap(); | ||
match _seed { | ||
UninhabitedUnivariant32::_Variant(_x) => {} | ||
} | ||
} |