Only omit trailing comma if block doesn't come from macro expansion
This commit is contained in:
parent
2b646bd533
commit
2c3bb42ebd
4 changed files with 50 additions and 4 deletions
14
src/test/ui/issue-94866.rs
Normal file
14
src/test/ui/issue-94866.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
macro_rules! m {
|
||||
() => {
|
||||
{}
|
||||
};
|
||||
}
|
||||
|
||||
enum Enum { A, B }
|
||||
|
||||
fn main() {
|
||||
match Enum::A {
|
||||
//~^ ERROR non-exhaustive patterns
|
||||
Enum::A => m!()
|
||||
}
|
||||
}
|
||||
21
src/test/ui/issue-94866.stderr
Normal file
21
src/test/ui/issue-94866.stderr
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
error[E0004]: non-exhaustive patterns: `B` not covered
|
||||
--> $DIR/issue-94866.rs:10:11
|
||||
|
|
||||
LL | match Enum::A {
|
||||
| ^^^^^^^ pattern `B` not covered
|
||||
|
|
||||
note: `Enum` defined here
|
||||
--> $DIR/issue-94866.rs:7:16
|
||||
|
|
||||
LL | enum Enum { A, B }
|
||||
| ---- ^ not covered
|
||||
= note: the matched value is of type `Enum`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ Enum::A => m!(),
|
||||
LL + B => todo!()
|
||||
|
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0004`.
|
||||
|
|
@ -12,7 +12,7 @@ LL | struct Foo(isize, isize);
|
|||
= note: the matched value is of type `Foo`
|
||||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
||||
|
|
||||
LL ~ Foo(2, b) => println!("{}", b)
|
||||
LL ~ Foo(2, b) => println!("{}", b),
|
||||
LL + Foo(_, _) => todo!()
|
||||
|
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue