-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Labels
Description
I tried this code:
- for testing
E0532
error, Arm Does Not Match Expected Kind - expected tuple struct or tuple variant, found struct variant. - Godbolt link.
enum State {
Succeeded,
Failed(u32),
}
fn print_on_failure(state: &State) {
match *state {
// error: expected unit struct, unit variant or constant, found tuple
// variant `State::Failed`
State::Failed => (),
_ => ()
}
}
I expected to see this happen:
Abort due to E0532
error
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `State::Failed`
--> <source>:10:9
|
3 | Failed(u32),
| ----------- `State::Failed` defined here
...
10 | State::Failed => (),
| ^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `State::Failed(_)`
error: aborting due to previous error
Instead, this happened:
Compiled with warning
<source>:6:1: warning: function is never used: 'print_on_failure'
6 | fn print_on_failure(state: &State) {
| ^~
Compiler returned: 0
Meta
- What version of Rust GCC were you using, git sha : ac43e58.
- gccrs (Compiler-Explorer-Build-gcc-3ccf008b148455c4800f2a7c70be03e1dd708c59-binutils-2.40) 13.0.1 20230417 (experimental)