From f641f5133bd0debee7e00e5fbb721045e7f6f87b Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Fri, 29 Jan 2021 16:33:15 +0900 Subject: [PATCH] Add rust-fix test --- src/test/ui/suggestions/field-access.fixed | 26 +++++++++++++++++++++ src/test/ui/suggestions/field-access.rs | 3 +++ src/test/ui/suggestions/field-access.stderr | 6 ++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 src/test/ui/suggestions/field-access.fixed 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 -- 2.44.0