diff options
| -rw-r--r-- | src/test/ui/suggestions/field-access.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/suggestions/field-access.stderr | 35 |
2 files changed, 42 insertions, 1 deletions
diff --git a/src/test/ui/suggestions/field-access.rs b/src/test/ui/suggestions/field-access.rs index 822f66f2a47..7bf621c21d3 100644 --- a/src/test/ui/suggestions/field-access.rs +++ b/src/test/ui/suggestions/field-access.rs @@ -12,4 +12,12 @@ fn main() { if let B::Fst = a {}; //~^ ERROR mismatched types [E0308] // note: you might have meant to use field `b` of type `B` + match a { + B::Fst => (), + B::Snd => (), + } + //~^^^ ERROR mismatched types [E0308] + // note: you might have meant to use field `b` of type `B` + //~^^^^ ERROR mismatched types [E0308] + // note: you might have meant to use field `b` of type `B` } diff --git a/src/test/ui/suggestions/field-access.stderr b/src/test/ui/suggestions/field-access.stderr index 58bc6d3f2da..a377f8f4dea 100644 --- a/src/test/ui/suggestions/field-access.stderr +++ b/src/test/ui/suggestions/field-access.stderr @@ -14,6 +14,39 @@ help: you might have meant to use field `b` of type `B` LL | if let B::Fst = a.b {}; | ^^^ -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/field-access.rs:16:9 + | +LL | Fst, + | --- unit variant defined here +... +LL | match a { + | - this expression has type `A` +LL | B::Fst => (), + | ^^^^^^ expected struct `A`, found enum `B` + | +help: you might have meant to use field `b` of type `B` + | +LL | match a.b { + | ^^^ + +error[E0308]: mismatched types + --> $DIR/field-access.rs:17:9 + | +LL | Snd, + | --- unit variant defined here +... +LL | match a { + | - this expression has type `A` +LL | B::Fst => (), +LL | B::Snd => (), + | ^^^^^^ expected struct `A`, found enum `B` + | +help: you might have meant to use field `b` of type `B` + | +LL | match a.b { + | ^^^ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0308`. |
