reflection: resolve false positive in unrelated ui-test

This commit is contained in:
Yara
2026-08-14 15:06:24 +02:00
parent 37e1969c97
commit a123594de1
2 changed files with 16 additions and 16 deletions

View File

@@ -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`
};
}

View File

@@ -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