2022-03-27 18:09:38 -05:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/compatible-variants-in-pat.rs:10:9
|
|
|
|
|
|
|
|
|
LL | match f {
|
|
|
|
| - this expression has type `Foo`
|
|
|
|
LL | Bar { x } => {
|
2023-01-02 20:00:33 -06:00
|
|
|
| ^^^^^^^^^ expected `Foo`, found `Bar`
|
2022-03-27 18:09:38 -05:00
|
|
|
|
|
|
|
|
help: try wrapping the pattern in `Foo::Bar`
|
|
|
|
|
|
|
|
|
LL | Foo::Bar(Bar { x }) => {
|
|
|
|
| +++++++++ +
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/compatible-variants-in-pat.rs:21:9
|
|
|
|
|
|
|
|
|
LL | struct S;
|
2022-02-13 09:27:59 -06:00
|
|
|
| -------- unit struct defined here
|
2022-03-27 18:09:38 -05:00
|
|
|
...
|
|
|
|
LL | match s {
|
|
|
|
| - this expression has type `Option<S>`
|
|
|
|
LL | S => {
|
|
|
|
| ^
|
|
|
|
| |
|
2023-01-02 20:00:33 -06:00
|
|
|
| expected `Option<S>`, found `S`
|
2022-03-27 18:09:38 -05:00
|
|
|
| `S` is interpreted as a unit struct, not a new binding
|
|
|
|
|
|
|
|
|
= note: expected enum `Option<S>`
|
|
|
|
found struct `S`
|
|
|
|
help: try wrapping the pattern in `Some`
|
|
|
|
|
|
|
|
|
LL | Some(S) => {
|
|
|
|
| +++++ +
|
|
|
|
help: introduce a new binding instead
|
|
|
|
|
|
|
|
|
LL | other_s => {
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/compatible-variants-in-pat.rs:32:9
|
|
|
|
|
|
|
|
|
LL | struct S;
|
2022-02-13 09:27:59 -06:00
|
|
|
| -------- unit struct defined here
|
2022-03-27 18:09:38 -05:00
|
|
|
...
|
|
|
|
LL | match s {
|
|
|
|
| - this expression has type `Result<S, S>`
|
|
|
|
LL | S => {
|
|
|
|
| ^
|
|
|
|
| |
|
2023-01-02 20:00:33 -06:00
|
|
|
| expected `Result<S, S>`, found `S`
|
2022-03-27 18:09:38 -05:00
|
|
|
| `S` is interpreted as a unit struct, not a new binding
|
|
|
|
|
|
|
|
|
= note: expected enum `Result<S, S>`
|
|
|
|
found struct `S`
|
|
|
|
help: try wrapping the pattern in a variant of `Result`
|
|
|
|
|
|
|
|
|
LL | Ok(S) => {
|
|
|
|
| +++ +
|
|
|
|
LL | Err(S) => {
|
|
|
|
| ++++ +
|
|
|
|
help: introduce a new binding instead
|
|
|
|
|
|
|
|
|
LL | other_s => {
|
|
|
|
| ~~~~~~~
|
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|