Closed
Description
Consider the following code:
fn main() {
struct S { one: u32, _two: u32 }
match (S { one: 1, _two: 2 }) {
S { one: 1, ... } => println!("oy"),
_ => println!("no"),
}
}
If you try to compile this, you get the following errors:
error: expected identifier, found `...`
--> src/main.rs:4:21
|
4 | S { one: 1, ... } => println!("oy"),
| ^^^
error[E0027]: pattern does not mention field `one`
--> src/main.rs:4:9
|
4 | S { one: 1, ... } => println!("oy"),
| ^^^^^^^^^^^^^^^^^ missing field `one`
error[E0027]: pattern does not mention field `_two`
--> src/main.rs:4:9
|
4 | S { one: 1, ... } => println!("oy"),
| ^^^^^^^^^^^^^^^^^ missing field `_two`
error: aborting due to 3 previous errors
See the bug?
Its because I used ...
when I should have used ..
It would be nice if the compiler, in its ever friendly manner, suggested the latter to me.
Metadata
Metadata
Assignees
Labels
No labels