summaryrefslogtreecommitdiffstats
path: root/src/test/ui/did_you_mean/compatible-variants-in-pat.stderr
blob: 473468af6eef8a6eacaf637d654786c5edf1dc9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
error[E0308]: mismatched types
  --> $DIR/compatible-variants-in-pat.rs:10:9
   |
LL |     match f {
   |           - this expression has type `Foo`
LL |         Bar { x } => {
   |         ^^^^^^^^^ expected enum `Foo`, found struct `Bar`
   |
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;
   | -------- unit struct defined here
...
LL |     match s {
   |           - this expression has type `Option<S>`
LL |         S => {
   |         ^
   |         |
   |         expected enum `Option`, found struct `S`
   |         `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;
   | -------- unit struct defined here
...
LL |     match s {
   |           - this expression has type `Result<S, S>`
LL |         S => {
   |         ^
   |         |
   |         expected enum `Result`, found struct `S`
   |         `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`.