Add a test for single variant matches
This commit is contained in:
parent
d8ece188b8
commit
866664c8bb
2 changed files with 23 additions and 2 deletions
|
|
@ -2,6 +2,14 @@ enum Foo {
|
|||
Prob,
|
||||
}
|
||||
|
||||
const FOO: u32 = match Foo::Prob {
|
||||
Foo::Prob => 42, //~ ERROR unimplemented expression type
|
||||
};
|
||||
|
||||
const BAR: u32 = match Foo::Prob {
|
||||
x => 42, //~ ERROR unimplemented expression type
|
||||
};
|
||||
|
||||
impl Foo {
|
||||
pub const fn as_val(&self) -> u8 {
|
||||
use self::Foo::*;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,21 @@
|
|||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/single_variant_match_ice.rs:6:5
|
||||
|
|
||||
LL | Foo::Prob => 42, //~ ERROR unimplemented expression type
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0019]: constant contains unimplemented expression type
|
||||
--> $DIR/single_variant_match_ice.rs:10:5
|
||||
|
|
||||
LL | x => 42, //~ ERROR unimplemented expression type
|
||||
| ^
|
||||
|
||||
error: `if`, `match`, `&&` and `||` are not stable in const fn
|
||||
--> $DIR/single_variant_match_ice.rs:10:13
|
||||
--> $DIR/single_variant_match_ice.rs:18:13
|
||||
|
|
||||
LL | Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0019`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue