Skip to content

Commit ad9f707

Browse files
committed
Fix test to check help message as well
1 parent f641f51 commit ad9f707

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

src/test/ui/suggestions/field-access.fixed

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ enum B {
1212

1313
fn main() {
1414
let a = A { b: B::Fst };
15-
if let B::Fst = a.b {};
16-
//~^ ERROR mismatched types [E0308]
17-
// note: you might have meant to use field `b` of type `B`
15+
if let B::Fst = a.b {}; //~ ERROR mismatched types [E0308]
16+
//~^ HELP you might have meant to use field `b` of type `B`
1817
match a.b {
19-
B::Fst => (),
20-
B::Snd => (),
18+
//~^ HELP you might have meant to use field `b` of type `B`
19+
//~| HELP you might have meant to use field `b` of type `B`
20+
B::Fst => (), //~ ERROR mismatched types [E0308]
21+
B::Snd => (), //~ ERROR mismatched types [E0308]
2122
}
22-
//~^^^ ERROR mismatched types [E0308]
23-
// note: you might have meant to use field `b` of type `B`
24-
//~^^^^ ERROR mismatched types [E0308]
25-
// note: you might have meant to use field `b` of type `B`
2623
}

src/test/ui/suggestions/field-access.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@ enum B {
1212

1313
fn main() {
1414
let a = A { b: B::Fst };
15-
if let B::Fst = a {};
16-
//~^ ERROR mismatched types [E0308]
17-
// note: you might have meant to use field `b` of type `B`
15+
if let B::Fst = a {}; //~ ERROR mismatched types [E0308]
16+
//~^ HELP you might have meant to use field `b` of type `B`
1817
match a {
19-
B::Fst => (),
20-
B::Snd => (),
18+
//~^ HELP you might have meant to use field `b` of type `B`
19+
//~| HELP you might have meant to use field `b` of type `B`
20+
B::Fst => (), //~ ERROR mismatched types [E0308]
21+
B::Snd => (), //~ ERROR mismatched types [E0308]
2122
}
22-
//~^^^ ERROR mismatched types [E0308]
23-
// note: you might have meant to use field `b` of type `B`
24-
//~^^^^ ERROR mismatched types [E0308]
25-
// note: you might have meant to use field `b` of type `B`
2623
}

src/test/ui/suggestions/field-access.stderr

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ LL | if let B::Fst = a.b {};
1515
| ^^^
1616

1717
error[E0308]: mismatched types
18-
--> $DIR/field-access.rs:19:9
18+
--> $DIR/field-access.rs:20:9
1919
|
2020
LL | Fst,
2121
| --- unit variant defined here
2222
...
2323
LL | match a {
2424
| - this expression has type `A`
25+
...
2526
LL | B::Fst => (),
2627
| ^^^^^^ expected struct `A`, found enum `B`
2728
|
@@ -31,14 +32,14 @@ LL | match a.b {
3132
| ^^^
3233

3334
error[E0308]: mismatched types
34-
--> $DIR/field-access.rs:20:9
35+
--> $DIR/field-access.rs:21:9
3536
|
3637
LL | Snd,
3738
| --- unit variant defined here
3839
...
3940
LL | match a {
4041
| - this expression has type `A`
41-
LL | B::Fst => (),
42+
...
4243
LL | B::Snd => (),
4344
| ^^^^^^ expected struct `A`, found enum `B`
4445
|

0 commit comments

Comments
 (0)