Closed as not planned
Description
Code
enum Example {
First(String),
Other(String)
}
fn main() {
let a = Example::First("wow".into());
match a {
Example::First("wow".into()) => unreachable!(),
_ => {
println!(":)");
}
}
}
Current output
Compiling playground v0.0.1 (/playground)
error: expected one of `)`, `,`, `...`, `..=`, `..`, or `|`, found `.`
--> src/main.rs:11:29
|
11 | Example::First("wow".into()) => unreachable!(),
| ^
| |
| expected one of `)`, `,`, `...`, `..=`, `..`, or `|`
| help: missing `,`
error[E0531]: cannot find tuple struct or tuple variant `into` in this scope
--> src/main.rs:11:30
|
11 | Example::First("wow".into()) => unreachable!(),
| ^^^^ not found in this scope
error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field
--> src/main.rs:11:24
|
2 | First(String),
| ------ tuple variant has 1 field
...
11 | Example::First("wow".into()) => unreachable!(),
| ^^^^^ ^^^^^^ expected 1 field, found 2
Some errors have detailed explanations: E0023, E0531.
For more information about an error, try `rustc --explain E0023`.
error: could not compile `playground` (bin "playground") due to 3 previous errors
Desired output
error[EXXXX]: expected tuple struct or tuple variant, found method call `into`
--> src/main.rs:11:24
|
11 | Example::First("wow".into()) => unreachable!(),
| ^^^^^^^^^^^^ `fn` calls are not allowed in patterns
|
= help: for more information, visit https://doc.rust-lang.org/book/ch18-00-patterns.html
Rationale and extra context
(updated playground link)
Other cases
No response
Anything else?
I gave an example desired output, but i think it can be better.