mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
reflection: resolve false positive in unrelated ui-test
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
// https://github.com/rust-lang/rust/issues/63983
|
||||
enum MyEnum {
|
||||
Tuple(i32),
|
||||
Struct{ s: i32 },
|
||||
HasTupleField(i32),
|
||||
HasStructField{ s: i32 },
|
||||
}
|
||||
|
||||
fn foo(en: MyEnum) {
|
||||
match en {
|
||||
MyEnum::Tuple => "",
|
||||
//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple`
|
||||
MyEnum::Struct => "",
|
||||
//~^ ERROR expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct`
|
||||
MyEnum::HasTupleField => "",
|
||||
//~^ ERROR expected unit struct, unit variant or constant, found tuple variant `MyEnum::HasTupleField`
|
||||
MyEnum::HasStructField => "",
|
||||
//~^ ERROR expected unit struct, unit variant or constant, found struct variant `MyEnum::HasStructField`
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `MyEnum::Tuple`
|
||||
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `MyEnum::HasTupleField`
|
||||
--> $DIR/unit-pattern-error-on-tuple-and-struct-variants-63983.rs:9:9
|
||||
|
|
||||
LL | Tuple(i32),
|
||||
| ---------- `MyEnum::Tuple` defined here
|
||||
LL | HasTupleField(i32),
|
||||
| ------------------ `MyEnum::HasTupleField` defined here
|
||||
...
|
||||
LL | MyEnum::Tuple => "",
|
||||
| ^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `MyEnum::Tuple(_)`
|
||||
LL | MyEnum::HasTupleField => "",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `MyEnum::HasTupleField(_)`
|
||||
|
||||
error[E0533]: expected unit struct, unit variant or constant, found struct variant `MyEnum::Struct`
|
||||
error[E0533]: expected unit struct, unit variant or constant, found struct variant `MyEnum::HasStructField`
|
||||
--> $DIR/unit-pattern-error-on-tuple-and-struct-variants-63983.rs:11:9
|
||||
|
|
||||
LL | MyEnum::Struct => "",
|
||||
| ^^^^^^^^^^^^^^ not a unit struct, unit variant or constant
|
||||
LL | MyEnum::HasStructField => "",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant
|
||||
|
|
||||
help: add the names to match a struct variant's fields
|
||||
|
|
||||
LL | MyEnum::Struct { s: _ } => "",
|
||||
| ++++++++
|
||||
LL | MyEnum::HasStructField { s: _ } => "",
|
||||
| ++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user