-
Notifications
You must be signed in to change notification settings - Fork 13.4k
No warning for an associated constant always hidden by an enum variant #76347
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
IIRC, when "variants as associated items" were accepted, the decision was to report an associated item overlap error similar to
in situations like this. |
I recently discovered this in rustdoc: #75756 (comment). I guess rustdoc should track the rustc behavior (right now it's buggy and gives the const precedence): rust/src/librustdoc/passes/collect_intra_doc_links.rs Lines 113 to 122 in 085e417
So give the variant precedence now and change it when/if rustc changes it. |
Can I start working on it? |
@petrochenkov, can you post a link of where this has been discussed? Also, this would break the test ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.rs. I am not sure if I should just remove the relevant code. By the way, should we emit an error when a function name is the same as an enum variant? |
Looks like this is related to #48758 (comment) |
Closing as a duplicate of #48758. |
To my great surprise, this compiles fine, with no warnings:
Trying to actually use that constant, however, doesn't work:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=d1e7c140a60c78cc6ede62b677a74e5e
If that constant is going to compile, it should probably at least be linted against.
The text was updated successfully, but these errors were encountered: