summaryrefslogtreecommitdiffstats
path: root/src/test/ui/did_you_mean/compatible-variants-in-pat.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/did_you_mean/compatible-variants-in-pat.rs')
-rw-r--r--src/test/ui/did_you_mean/compatible-variants-in-pat.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/test/ui/did_you_mean/compatible-variants-in-pat.rs b/src/test/ui/did_you_mean/compatible-variants-in-pat.rs
new file mode 100644
index 000000000..09e12dab2
--- /dev/null
+++ b/src/test/ui/did_you_mean/compatible-variants-in-pat.rs
@@ -0,0 +1,41 @@
+enum Foo {
+ Bar(Bar),
+}
+struct Bar {
+ x: i32,
+}
+
+fn a(f: Foo) {
+ match f {
+ Bar { x } => {
+ //~^ ERROR mismatched types
+ //~| HELP try wrapping
+ }
+ }
+}
+
+struct S;
+
+fn b(s: Option<S>) {
+ match s {
+ S => {
+ //~^ ERROR mismatched types
+ //~| HELP try wrapping
+ //~| HELP introduce a new binding instead
+ }
+ _ => {}
+ }
+}
+
+fn c(s: Result<S, S>) {
+ match s {
+ S => {
+ //~^ ERROR mismatched types
+ //~| HELP try wrapping
+ //~| HELP introduce a new binding instead
+ }
+ _ => {}
+ }
+}
+
+fn main() {}