-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add enum_intrinsics_non_enums lint #83908
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
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
While I'm at it, I made the lint also check variant_count |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Flying-Toast When this lint is uplifted, the Clippy lint should be deprecated properly. Since this is a lengthy procedure and explaining it takes longer than doing it myself, please ping me once the |
@flip1995 Thanks. This PR is ready now |
Thanks! I'm waiting for a review of the rustc part and confirmation that this lint should be uplifted. After that, I'll provide the necessary Clippy changes. |
@estebank any update? |
☔ The latest upstream changes (presumably #87242) made this pull request unmergeable. Please resolve the merge conflicts. |
@estebank when do you think you can review this? |
r? @davidtwco |
☔ The latest upstream changes (presumably #84039) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, r=me after rebase, apologies this took so long to be reviewed.
@Flying-Toast please apply the patch in this gist for the PR to pass the Clippy test suite. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@Flying-Toast GitHub is still reporting your branch as having conflicts, have you been able to rebase? |
Ping again from triage: |
@JohnCSimon @davidtwco I've rebased the PR, sorry for the delay - I've been busy with school. @flip1995: The patch doesn't apply very well anymore by now - could you make the patch again? |
@Flying-Toast rust-lang/rust follows a "No-Merge Policy". Could you please rebase over upstream changes instead of merging? Thanks! |
This lint has been uplifted and is now included in enum_intrinsics_non_enums.
I updated the gist. This is based on a rebased version of this branch ontop of the current master branch. I also pushed a already rebased version with this patch applied here: https://github.com/flip1995/rust/tree/enum_intrinsics_non_enums You can just force push this to your branch: git remote add flip1995 https://github.com/flip1995/rust --fetch
# The next command assumes, that `origin` is the remote of your fork.
git push origin enum_intrinsics_non_enums:master --force-with-lease |
@flip1995 thanks :) I've pushed from your branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@bors r+ |
📌 Commit f483676 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (5b21064): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
There is a clippy lint to prevent calling
mem::discriminant
with a non-enum type. I think the lint is worthy of being included in rustc, given thatdiscriminant::<T>()
whereT
is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this.I've also made the lint check variant_count (#73662).
closes #83899