rust/tests/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
794 B
Rust
Raw Normal View History

enum Example { Ex(String), NotEx }
enum Void {}
enum ManyVariants {
One,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
}
2017-11-15 01:20:09 -06:00
fn result_test() {
let x = Option(1); //~ ERROR expected function, tuple struct or tuple variant, found enum
2017-11-15 01:20:09 -06:00
if let Option(_) = x { //~ ERROR expected tuple struct or tuple variant, found enum
2017-11-15 01:20:09 -06:00
println!("It is OK.");
}
let y = Example::Ex(String::from("test"));
if let Example(_) = y { //~ ERROR expected tuple struct or tuple variant, found enum
println!("It is OK.");
}
let y = Void(); //~ ERROR expected function, tuple struct or tuple variant, found enum
let z = ManyVariants(); //~ ERROR expected function, tuple struct or tuple variant, found enum
2017-11-15 01:20:09 -06:00
}
fn main() {}