Skip to content

Commit f641f51

Browse files
committed
Add rust-fix test
1 parent a9abf6f commit f641f51

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// run-rustfix
2+
#![allow(dead_code)]
3+
4+
struct A {
5+
b: B,
6+
}
7+
8+
enum B {
9+
Fst,
10+
Snd,
11+
}
12+
13+
fn main() {
14+
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`
18+
match a.b {
19+
B::Fst => (),
20+
B::Snd => (),
21+
}
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`
26+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// run-rustfix
2+
#![allow(dead_code)]
3+
14
struct A {
25
b: B,
36
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0308]: mismatched types
2-
--> $DIR/field-access.rs:12:12
2+
--> $DIR/field-access.rs:15:12
33
|
44
LL | Fst,
55
| --- unit variant defined here
@@ -15,7 +15,7 @@ LL | if let B::Fst = a.b {};
1515
| ^^^
1616

1717
error[E0308]: mismatched types
18-
--> $DIR/field-access.rs:16:9
18+
--> $DIR/field-access.rs:19:9
1919
|
2020
LL | Fst,
2121
| --- unit variant defined here
@@ -31,7 +31,7 @@ LL | match a.b {
3131
| ^^^
3232

3333
error[E0308]: mismatched types
34-
--> $DIR/field-access.rs:17:9
34+
--> $DIR/field-access.rs:20:9
3535
|
3636
LL | Snd,
3737
| --- unit variant defined here

0 commit comments

Comments
 (0)