-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary parentheses warning for (A | B) as :pat in 2018 edition #86959
Comments
I've tried bisecting this and it seems that the warning was introduced a long time ago, exactly on
bisectecd with
and this helper script
|
Yes, I wouldn't expect bisecting to tell much in this instance because I wouldn't expect this to be a regression? I could be wrong, but it seems pretty clear how this behavior arises as a logical consequence of other behaviors of the compiler, and normally "unused" warnings are just a basic fact of life when working with macros. I created an issue for this warning because I feel that this one is particularly easy to run into (i.e. it's "a paper cut"); there is a clear use case for writing parenthesized |
@ExpHP yes, totally agree. I've tried a diagnose because I was confused about the "edition 2021" part of your report: also trying to make this code "2021-ready", the warning does not disappear without forcing it out by adding Perhaps related to #80636 and (in cascade) to #78747 Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-medium |
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=30f392098326a970e468c3125f7c5413
The current output is:
While it would be true that these parentheses are unnecessary in 2021 edition, (and also of course in the macro expanded output as well, which is why the warning occurs), they are required here in 2018 edition because
:pat
cannot match'a' | 'A'
in this edition, making the warning a nuisance.The text was updated successfully, but these errors were encountered: