Skip to content

Commit ebb0759

Browse files
committed
Add a test for regular wildcard
fix
1 parent 055f349 commit ebb0759

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

tests/ui/match_wildcard_for_single_variants.fixed

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,11 @@ mod issue9993 {
146146
Foo::A(false) => 2,
147147
Foo::B => 3,
148148
};
149+
150+
let _ = match Foo::B {
151+
_ if false => 0,
152+
Foo::A(_) => 1,
153+
Foo::B => 2,
154+
};
149155
}
150156
}

tests/ui/match_wildcard_for_single_variants.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,11 @@ mod issue9993 {
146146
Foo::A(false) => 2,
147147
Foo::B => 3,
148148
};
149+
150+
let _ = match Foo::B {
151+
_ if false => 0,
152+
Foo::A(_) => 1,
153+
_ => 2,
154+
};
149155
}
150156
}

tests/ui/match_wildcard_for_single_variants.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,11 @@ error: wildcard matches only a single variant and will also match any future add
4848
LL | _ => (),
4949
| ^ help: try this: `Color::Blue`
5050

51-
error: aborting due to 8 previous errors
51+
error: wildcard matches only a single variant and will also match any future added variants
52+
--> $DIR/match_wildcard_for_single_variants.rs:153:13
53+
|
54+
LL | _ => 2,
55+
| ^ help: try this: `Foo::B`
56+
57+
error: aborting due to 9 previous errors
5258

0 commit comments

Comments
 (0)