Closed
Description
I tried this code:
#![warn(rust_2021_incompatible_or_patterns)]
macro_rules! mac {
(|$a:pat, $b:pat|) => {};
(|$a:pat|) => {};
}
fn main() {
mac!(|a|);
}
I expected to see this happen: Suggestions should change all pat
matchers to pat_param
.
Instead, this happened: The lint misses the first pattern. That is, after the suggestions:
#![warn(rust_2021_incompatible_or_patterns)]
macro_rules! mac {
(|$a:pat, $b:pat_param|) => {};
(|$a:pat_param|) => {};
}
fn main() {
mac!(|a|);
}
But this fails to compile in 2021:
error: expected pattern, found `<eof>`
--> src/main.rs:9:12
|
4 | (|$a:pat, $b:pat_param|) => {};
| ------ while parsing argument for this `pat` macro fragment
...
9 | mac!(|a|);
| -^ expected pattern
| |
| while parsing this or-pattern starting here
Found while trying to migrate stakker
0.2.4.
Meta
rustc --version --verbose
:
rustc 1.56.0-nightly (0035d9dce 2021-08-16)
binary: rustc
commit-hash: 0035d9dcecee49d1f7349932bfa52c05a6f83641
commit-date: 2021-08-16
host: x86_64-apple-darwin
release: 1.56.0-nightly
LLVM version: 12.0.1