Skip to content

Commit a6196fa

Browse files
committed
Relocate issues/issue-52717.rs to
match/match-enum-struct-variant-field-missing.rs
1 parent 752ea07 commit a6196fa

File tree

4 files changed

+29
-25
lines changed

4 files changed

+29
-25
lines changed

tests/ui/issues/issue-52717.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/ui/issues/issue-52717.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//! Regression test for issue <https://github.com/rust-lang/rust/issues/52717>
2+
//! Test that matching an enum struct variant with a missing or incorrect field name
3+
//! correctly yields a "does not have a field named" error.
4+
5+
enum A {
6+
A { foo: usize },
7+
}
8+
9+
fn main() {
10+
let x = A::A { foo: 3 };
11+
match x {
12+
A::A { fob } => {
13+
//~^ ERROR does not have a field named `fob`
14+
println!("{fob}");
15+
}
16+
}
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0026]: variant `A::A` does not have a field named `fob`
2+
--> $DIR/match-enum-struct-variant-field-missing.rs:12:16
3+
|
4+
LL | A::A { fob } => {
5+
| ^^^
6+
| |
7+
| variant `A::A` does not have this field
8+
| help: a field with a similar name exists: `foo`
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0026`.

0 commit comments

Comments
 (0)