Closed
Description
This seems to be a new issue in Rust 1.50. The latest nightly does not have this issue.
macro_rules! some {
($item:pat) => {
Some($item)
};
}
fn main() {
let a = Some('A');
match a {
some!('a') | some!('A') => println!("A!"),
_ => println!("Not a!"),
}
}
It prints "A!"
without any error, but gives the following warning.
warning: unreachable pattern
--> src/main.rs:3:9
|
3 | Some($item)
| ^^^^^^^^^^^
...
10 | some!('a') | some!('A') => println!("A!"),
| ---------- in this macro invocation
|
= note: `#[warn(unreachable_patterns)]` on by default
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
warning: 1 warning emitted
some!('A')
is obviously reachable, otherwise it won't print "A!"
.