-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add lint on large non scalar const #5248
Conversation
☔ The latest upstream changes (presumably #5230) 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 overall. The suggestion needs a small change, after that, this should be good to go.
6a197c0
to
ab25eee
Compare
☔ The latest upstream changes (presumably #5380) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #5294) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #5398) made this pull request unmergeable. Please resolve the merge conflicts. |
60ede1d
to
3cedc6a
Compare
☔ The latest upstream changes (presumably #5438) made this pull request unmergeable. Please resolve the merge conflicts. |
Thanks! Sorry for taking so long for the review. I don't have an excuse, just wasn't really motivated to review PRs recently. Waiting for rustup. |
@bors r+ rollup |
📌 Commit 629cc4a has been approved by |
🌲 The tree is currently closed for pull requests below priority 1, this pull request will be tested once the tree is reopened |
Rollup of 5 pull requests Successful merges: - #5226 (Add lint for explicit deref and deref_mut method calls) - #5248 (Add lint on large non scalar const) - #5430 (Disallow bit-shifting in integer_arithmetic) - #5466 (large_enum_variant: Report sizes of variants) - #5468 (Zero single char names) Failed merges: r? @ghost changelog: rollup
This PR adds the new lint
non_scalar_const
that aims to warn againstconst
declaration of large arrays. For performance, because of inlining, large arrays should be preferably declared asstatic
.Note: i made this one to warn on all const arrays, whether they are in a body function or not. I don't know if this is really necessary, i could just reduce this lint to variables out of function scope.
Fixes: #400
changelog: add new lint for large non-scalar types declared as const