(..=0 | 2)
in macro does not compile without parentheses but generates warning for unnecessary parentheses
#120737
Labels
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-patterns
Relating to patterns and pattern matching
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-bug
Category: This is a bug.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
L-unused_parens
Lint: unused_parens
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: At least one of the expressions should compile without warning.
Instead, this happened: The first expression does not compile. The second expression generates a warning asking you to remove the parentheses.
This happens with any macro with a pattern matcher that ends up used. Skipping the parentheses does compile if the unstable exclusive range patterns are used, so I imagine this should work as well.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: