Fix test to check help message as well

This commit is contained in:
Hirochika Matsumoto 2021-01-30 13:42:01 +09:00
parent f641f5133b
commit ad9f707bf5
3 changed files with 16 additions and 21 deletions

View File

@ -12,15 +12,12 @@ enum B {
fn main() { fn main() {
let a = A { b: B::Fst }; let a = A { b: B::Fst };
if let B::Fst = a.b {}; if let B::Fst = a.b {}; //~ ERROR mismatched types [E0308]
//~^ ERROR mismatched types [E0308] //~^ HELP you might have meant to use field `b` of type `B`
// note: you might have meant to use field `b` of type `B`
match a.b { match a.b {
B::Fst => (), //~^ HELP you might have meant to use field `b` of type `B`
B::Snd => (), //~| HELP you might have meant to use field `b` of type `B`
B::Fst => (), //~ ERROR mismatched types [E0308]
B::Snd => (), //~ ERROR mismatched types [E0308]
} }
//~^^^ 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`
} }

View File

@ -12,15 +12,12 @@ enum B {
fn main() { fn main() {
let a = A { b: B::Fst }; let a = A { b: B::Fst };
if let B::Fst = a {}; if let B::Fst = a {}; //~ ERROR mismatched types [E0308]
//~^ ERROR mismatched types [E0308] //~^ HELP you might have meant to use field `b` of type `B`
// note: you might have meant to use field `b` of type `B`
match a { match a {
B::Fst => (), //~^ HELP you might have meant to use field `b` of type `B`
B::Snd => (), //~| HELP you might have meant to use field `b` of type `B`
B::Fst => (), //~ ERROR mismatched types [E0308]
B::Snd => (), //~ ERROR mismatched types [E0308]
} }
//~^^^ 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`
} }

View File

@ -15,13 +15,14 @@ LL | if let B::Fst = a.b {};
| ^^^ | ^^^
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/field-access.rs:19:9 --> $DIR/field-access.rs:20:9
| |
LL | Fst, LL | Fst,
| --- unit variant defined here | --- unit variant defined here
... ...
LL | match a { LL | match a {
| - this expression has type `A` | - this expression has type `A`
...
LL | B::Fst => (), LL | B::Fst => (),
| ^^^^^^ expected struct `A`, found enum `B` | ^^^^^^ expected struct `A`, found enum `B`
| |
@ -31,14 +32,14 @@ LL | match a.b {
| ^^^ | ^^^
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/field-access.rs:20:9 --> $DIR/field-access.rs:21:9
| |
LL | Snd, LL | Snd,
| --- unit variant defined here | --- unit variant defined here
... ...
LL | match a { LL | match a {
| - this expression has type `A` | - this expression has type `A`
LL | B::Fst => (), ...
LL | B::Snd => (), LL | B::Snd => (),
| ^^^^^^ expected struct `A`, found enum `B` | ^^^^^^ expected struct `A`, found enum `B`
| |