Skip to content

Conversation

ThibsG
Copy link
Contributor

@ThibsG ThibsG commented Mar 1, 2020

This PR adds the new lint non_scalar_const that aims to warn against const declaration of large arrays. For performance, because of inlining, large arrays should be preferably declared as static.

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

@JohnTitor JohnTitor added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 2, 2020
@flip1995 flip1995 added the A-lint Area: New lints label Mar 3, 2020
@flip1995 flip1995 added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Mar 3, 2020
@bors
Copy link
Contributor

bors commented Mar 5, 2020

☔ The latest upstream changes (presumably #5230) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@flip1995 flip1995 left a 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.

@flip1995 flip1995 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Mar 23, 2020
@ThibsG ThibsG force-pushed the ConstValues branch 3 times, most recently from 6a197c0 to ab25eee Compare March 23, 2020 22:16
@bors
Copy link
Contributor

bors commented Mar 30, 2020

☔ The latest upstream changes (presumably #5380) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Mar 30, 2020

☔ The latest upstream changes (presumably #5294) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Mar 31, 2020

☔ The latest upstream changes (presumably #5398) made this pull request unmergeable. Please resolve the merge conflicts.

@ThibsG ThibsG force-pushed the ConstValues branch 2 times, most recently from 60ede1d to 3cedc6a Compare April 2, 2020 07:32
@bors
Copy link
Contributor

bors commented Apr 8, 2020

☔ The latest upstream changes (presumably #5438) made this pull request unmergeable. Please resolve the merge conflicts.

@flip1995 flip1995 added S-waiting-on-bors Status: The marked PR was approved and is only waiting bors and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Apr 15, 2020
@flip1995
Copy link
Member

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.

@flip1995
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 15, 2020

📌 Commit 629cc4a has been approved by flip1995

@bors
Copy link
Contributor

bors commented Apr 15, 2020

🌲 The tree is currently closed for pull requests below priority 1, this pull request will be tested once the tree is reopened

bors added a commit that referenced this pull request Apr 15, 2020
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
@bors bors merged commit ceea3c6 into rust-lang:master Apr 15, 2020
@ThibsG ThibsG deleted the ConstValues branch April 15, 2020 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints S-waiting-on-bors Status: The marked PR was approved and is only waiting bors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn for non-scalar const values
4 participants