diff options
| author | Hirochika Matsumoto <matsujika@gmail.com> | 2021-01-29 16:33:15 +0900 |
|---|---|---|
| committer | Hirochika Matsumoto <matsujika@gmail.com> | 2021-01-29 16:33:15 +0900 |
| commit | f641f5133bd0debee7e00e5fbb721045e7f6f87b (patch) | |
| tree | 9cf9c51fbeaa3416dbf59967d47922029a0a3658 /src/test/ui | |
| parent | a9abf6f08663dce7b69cac826ca943149a6b093b (diff) | |
| download | rust-f641f5133bd0debee7e00e5fbb721045e7f6f87b.tar.gz rust-f641f5133bd0debee7e00e5fbb721045e7f6f87b.zip | |
Add rust-fix test
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/suggestions/field-access.fixed | 26 | ||||
| -rw-r--r-- | src/test/ui/suggestions/field-access.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/suggestions/field-access.stderr | 6 |
3 files changed, 32 insertions, 3 deletions
diff --git a/src/test/ui/suggestions/field-access.fixed b/src/test/ui/suggestions/field-access.fixed new file mode 100644 index 00000000000..d580902f2e7 --- /dev/null +++ b/src/test/ui/suggestions/field-access.fixed @@ -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` +} diff --git a/src/test/ui/suggestions/field-access.rs b/src/test/ui/suggestions/field-access.rs index 7bf621c21d3..ed6f9b2112b 100644 --- a/src/test/ui/suggestions/field-access.rs +++ b/src/test/ui/suggestions/field-access.rs @@ -1,3 +1,6 @@ +// run-rustfix +#![allow(dead_code)] + struct A { b: B, } diff --git a/src/test/ui/suggestions/field-access.stderr b/src/test/ui/suggestions/field-access.stderr index a377f8f4dea..ba7e145c217 100644 --- a/src/test/ui/suggestions/field-access.stderr +++ b/src/test/ui/suggestions/field-access.stderr @@ -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 |
