fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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