Add rust-fix test
This commit is contained in:
parent
a9abf6f086
commit
f641f5133b
3 changed files with 32 additions and 3 deletions
26
src/test/ui/suggestions/field-access.fixed
Normal file
26
src/test/ui/suggestions/field-access.fixed
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// run-rustfix
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct A {
|
||||
b: B,
|
||||
}
|
||||
|
||||
enum B {
|
||||
Fst,
|
||||
Snd,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let a = A { b: B::Fst };
|
||||
if let B::Fst = a.b {};
|
||||
//~^ ERROR mismatched types [E0308]
|
||||
// note: you might have meant to use field `b` of type `B`
|
||||
match a.b {
|
||||
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`
|
||||
}
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// run-rustfix
|
||||
#![allow(dead_code)]
|
||||
|
||||
struct A {
|
||||
b: B,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/field-access.rs:12:12
|
||||
--> $DIR/field-access.rs:15:12
|
||||
|
|
||||
LL | Fst,
|
||||
| --- unit variant defined here
|
||||
|
|
@ -15,7 +15,7 @@ LL | if let B::Fst = a.b {};
|
|||
| ^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/field-access.rs:16:9
|
||||
--> $DIR/field-access.rs:19:9
|
||||
|
|
||||
LL | Fst,
|
||||
| --- unit variant defined here
|
||||
|
|
@ -31,7 +31,7 @@ LL | match a.b {
|
|||
| ^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/field-access.rs:17:9
|
||||
--> $DIR/field-access.rs:20:9
|
||||
|
|
||||
LL | Snd,
|
||||
| --- unit variant defined here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue