From ebb0759bb3a9341ff662551366efb1844c91d3ca Mon Sep 17 00:00:00 2001 From: koka Date: Sun, 11 Dec 2022 12:20:46 +0900 Subject: [PATCH] Add a test for regular wildcard fix --- tests/ui/match_wildcard_for_single_variants.fixed | 6 ++++++ tests/ui/match_wildcard_for_single_variants.rs | 6 ++++++ tests/ui/match_wildcard_for_single_variants.stderr | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/ui/match_wildcard_for_single_variants.fixed b/tests/ui/match_wildcard_for_single_variants.fixed index c508b7cc3..fc252cdd3 100644 --- a/tests/ui/match_wildcard_for_single_variants.fixed +++ b/tests/ui/match_wildcard_for_single_variants.fixed @@ -146,5 +146,11 @@ mod issue9993 { Foo::A(false) => 2, Foo::B => 3, }; + + let _ = match Foo::B { + _ if false => 0, + Foo::A(_) => 1, + Foo::B => 2, + }; } } diff --git a/tests/ui/match_wildcard_for_single_variants.rs b/tests/ui/match_wildcard_for_single_variants.rs index ad03f7971..9a5c849e6 100644 --- a/tests/ui/match_wildcard_for_single_variants.rs +++ b/tests/ui/match_wildcard_for_single_variants.rs @@ -146,5 +146,11 @@ mod issue9993 { Foo::A(false) => 2, Foo::B => 3, }; + + let _ = match Foo::B { + _ if false => 0, + Foo::A(_) => 1, + _ => 2, + }; } } diff --git a/tests/ui/match_wildcard_for_single_variants.stderr b/tests/ui/match_wildcard_for_single_variants.stderr index 34538dea8..6fa313dc9 100644 --- a/tests/ui/match_wildcard_for_single_variants.stderr +++ b/tests/ui/match_wildcard_for_single_variants.stderr @@ -48,5 +48,11 @@ error: wildcard matches only a single variant and will also match any future add LL | _ => (), | ^ help: try this: `Color::Blue` -error: aborting due to 8 previous errors +error: wildcard matches only a single variant and will also match any future added variants + --> $DIR/match_wildcard_for_single_variants.rs:153:13 + | +LL | _ => 2, + | ^ help: try this: `Foo::B` + +error: aborting due to 9 previous errors