File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,12 @@ fn main() {
1212 if let B :: Fst = a { } ;
1313 //~^ ERROR mismatched types [E0308]
1414 // note: you might have meant to use field `b` of type `B`
15+ match a {
16+ B :: Fst => ( ) ,
17+ B :: Snd => ( ) ,
18+ }
19+ //~^^^ ERROR mismatched types [E0308]
20+ // note: you might have meant to use field `b` of type `B`
21+ //~^^^^ ERROR mismatched types [E0308]
22+ // note: you might have meant to use field `b` of type `B`
1523}
Original file line number Diff line number Diff line change @@ -14,6 +14,39 @@ help: you might have meant to use field `b` of type `B`
1414LL | if let B::Fst = a.b {};
1515 | ^^^
1616
17- error: aborting due to previous error
17+ error[E0308]: mismatched types
18+ --> $DIR/field-access.rs:16:9
19+ |
20+ LL | Fst,
21+ | --- unit variant defined here
22+ ...
23+ LL | match a {
24+ | - this expression has type `A`
25+ LL | B::Fst => (),
26+ | ^^^^^^ expected struct `A`, found enum `B`
27+ |
28+ help: you might have meant to use field `b` of type `B`
29+ |
30+ LL | match a.b {
31+ | ^^^
32+
33+ error[E0308]: mismatched types
34+ --> $DIR/field-access.rs:17:9
35+ |
36+ LL | Snd,
37+ | --- unit variant defined here
38+ ...
39+ LL | match a {
40+ | - this expression has type `A`
41+ LL | B::Fst => (),
42+ LL | B::Snd => (),
43+ | ^^^^^^ expected struct `A`, found enum `B`
44+ |
45+ help: you might have meant to use field `b` of type `B`
46+ |
47+ LL | match a.b {
48+ | ^^^
49+
50+ error: aborting due to 3 previous errors
1851
1952For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments