]> git.lizzy.rs Git - rust.git/blob - tests/ui/did_you_mean/compatible-variants-in-pat.stderr
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / did_you_mean / compatible-variants-in-pat.stderr
1 error[E0308]: mismatched types
2   --> $DIR/compatible-variants-in-pat.rs:10:9
3    |
4 LL |     match f {
5    |           - this expression has type `Foo`
6 LL |         Bar { x } => {
7    |         ^^^^^^^^^ expected enum `Foo`, found struct `Bar`
8    |
9 help: try wrapping the pattern in `Foo::Bar`
10    |
11 LL |         Foo::Bar(Bar { x }) => {
12    |         +++++++++         +
13
14 error[E0308]: mismatched types
15   --> $DIR/compatible-variants-in-pat.rs:21:9
16    |
17 LL | struct S;
18    | -------- unit struct defined here
19 ...
20 LL |     match s {
21    |           - this expression has type `Option<S>`
22 LL |         S => {
23    |         ^
24    |         |
25    |         expected enum `Option`, found struct `S`
26    |         `S` is interpreted as a unit struct, not a new binding
27    |
28    = note: expected enum `Option<S>`
29             found struct `S`
30 help: try wrapping the pattern in `Some`
31    |
32 LL |         Some(S) => {
33    |         +++++ +
34 help: introduce a new binding instead
35    |
36 LL |         other_s => {
37    |         ~~~~~~~
38
39 error[E0308]: mismatched types
40   --> $DIR/compatible-variants-in-pat.rs:32:9
41    |
42 LL | struct S;
43    | -------- unit struct defined here
44 ...
45 LL |     match s {
46    |           - this expression has type `Result<S, S>`
47 LL |         S => {
48    |         ^
49    |         |
50    |         expected enum `Result`, found struct `S`
51    |         `S` is interpreted as a unit struct, not a new binding
52    |
53    = note: expected enum `Result<S, S>`
54             found struct `S`
55 help: try wrapping the pattern in a variant of `Result`
56    |
57 LL |         Ok(S) => {
58    |         +++ +
59 LL |         Err(S) => {
60    |         ++++ +
61 help: introduce a new binding instead
62    |
63 LL |         other_s => {
64    |         ~~~~~~~
65
66 error: aborting due to 3 previous errors
67
68 For more information about this error, try `rustc --explain E0308`.