Skip to content

Commit

Permalink
Added oli's multivariant test case (alpha renaming the enum name itse…
Browse files Browse the repository at this point in the history
…lf).

(And added Ralf's suggested test.)

Added my own three-variant multi-variant as well.
  • Loading branch information
pnkfelix committed Mar 6, 2020
1 parent 40809b0 commit b4422fb
Showing 1 changed file with 63 additions and 3 deletions.
66 changes: 63 additions & 3 deletions src/test/ui/consts/issue-69191-ice-on-uninhabited-enum-field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,80 @@

pub enum Void {}

enum UninhabitedUnivariant { _Variant(Void), }
enum UninhabitedUnivariant {
_Variant(Void),
}

enum UninhabitedMultivariant2 {
_Variant(Void),
_Warriont(Void),
}

enum UninhabitedMultivariant3 {
_Variant(Void),
_Warriont(Void),
_Worrynot(Void),
}

#[repr(C)]
enum UninhabitedUnivariantC { _Variant(Void), }
enum UninhabitedUnivariantC {
_Variant(Void),
}

#[repr(i32)]
enum UninhabitedUnivariant32 { _Variant(Void), }
enum UninhabitedUnivariant32 {
_Variant(Void),
}

fn main() {
let _seed: UninhabitedUnivariant = None.unwrap();
match _seed {
UninhabitedUnivariant::_Variant(_x) => {}
}

let _seed: UninhabitedMultivariant2 = None.unwrap();
match _seed {
UninhabitedMultivariant2::_Variant(_x) => {}
UninhabitedMultivariant2::_Warriont(_x) => {}
}

let _seed: UninhabitedMultivariant2 = None.unwrap();
match _seed {
UninhabitedMultivariant2::_Variant(_x) => {}
_ => {}
}

let _seed: UninhabitedMultivariant2 = None.unwrap();
match _seed {
UninhabitedMultivariant2::_Warriont(_x) => {}
_ => {}
}

let _seed: UninhabitedMultivariant3 = None.unwrap();
match _seed {
UninhabitedMultivariant3::_Variant(_x) => {}
UninhabitedMultivariant3::_Warriont(_x) => {}
UninhabitedMultivariant3::_Worrynot(_x) => {}
}

let _seed: UninhabitedMultivariant3 = None.unwrap();
match _seed {
UninhabitedMultivariant3::_Variant(_x) => {}
_ => {}
}

let _seed: UninhabitedMultivariant3 = None.unwrap();
match _seed {
UninhabitedMultivariant3::_Warriont(_x) => {}
_ => {}
}

let _seed: UninhabitedMultivariant3 = None.unwrap();
match _seed {
UninhabitedMultivariant3::_Worrynot(_x) => {}
_ => {}
}

let _seed: UninhabitedUnivariantC = None.unwrap();
match _seed {
UninhabitedUnivariantC::_Variant(_x) => {}
Expand Down

0 comments on commit b4422fb

Please sign in to comment.