Skip to content

Refactor must_use lint into two parts - #104359

Merged
bors merged 1 commit into
rust-lang:masterfrom
Noratrieb:plus-one
Nov 23, 2022
Merged

Refactor must_use lint into two parts#104359
bors merged 1 commit into
rust-lang:masterfrom
Noratrieb:plus-one

Conversation

@Noratrieb

@NoratriebNoratrieb commented Nov 13, 2022

Copy link
Copy Markdown
Member

Before, the lint did the checking for must_use and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.

Also fixes an integer overflow in the array length pluralization
calculation.

fixes#104352

@rustbot

Copy link
Copy Markdown
Collaborator

r? @fee1-dead

(rustbot has picked a reviewer for you, use r? to override)

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 13, 2022
Comment threadcompiler/rustc_lint/src/unused.rs Outdated
@rust-log-analyzer

This comment has been minimized.

Comment threadcompiler/rustc_lint/src/unused.rs Outdated
@NoratriebNoratrieb changed the title Remove + 1 on pluralization count from must_use lintRefactor must_use lint into two partsNov 17, 2022
@Noratrieb

Copy link
Copy Markdown
MemberAuthor

I simplified the fix to really just do a saturating_add but also refactored a bunch of the code to (hopefully) make it easier to translate in the future and also make it less messy.

@rust-log-analyzer

This comment has been minimized.

@fee1-dead

Copy link
Copy Markdown
Member

@rustbot author please fix CI

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 19, 2022
@Noratrieb

Copy link
Copy Markdown
MemberAuthor

It should work again now, but I still don't like the way some of these things are structured. I need to think about it a little more.

Before, the lint did the checking for `must_use` and pretty printing the
types in a special format in one pass, causing quite complex and
untranslatable code.
Now the collection and printing is split in two. That should also make
it easier to translate or extract the type pretty printing in the
future.
Also fixes an integer overflow in the array length pluralization
calculation.
@fee1-dead

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Nov 20, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 4e9ceef has been approved by fee1-dead

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 20, 2022
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 22, 2022
Refactor must_use lint into two parts
Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.
Also fixes an integer overflow in the array length pluralization
calculation.
fixesrust-lang#104352
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 22, 2022
Refactor must_use lint into two parts
Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.
Also fixes an integer overflow in the array length pluralization
calculation.
fixesrust-lang#104352
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 23, 2022
Refactor must_use lint into two parts
Before, the lint did the checking for `must_use` and pretty printing the types in a special format in one pass, causing quite complex and untranslatable code.
Now the collection and printing is split in two. That should also make it easier to translate or extract the type pretty printing in the future.
Also fixes an integer overflow in the array length pluralization
calculation.
fixesrust-lang#104352
This was referenced Nov 23, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 23, 2022
…earth
Rollup of 6 pull requests
Successful merges:
- rust-lang#103488 (Allow opaque types in trait impl headers and rely on coherence to reject unsound cases)
- rust-lang#104359 (Refactor must_use lint into two parts)
- rust-lang#104612 (Lower return type outside async block creation)
- rust-lang#104621 (Fix --extern library finding errors)
- rust-lang#104647 (enable fuzzy_provenance_casts lint in liballoc and libstd)
- rust-lang#104750 (Bump `fd-lock` in `bootstrap` again)
Failed merges:
- rust-lang#104732 (Refactor `ty::ClosureKind` related stuff)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit a673364 into rust-lang:masterNov 23, 2022
@rustbotrustbot added this to the 1.67.0 milestone Nov 23, 2022
@Noratrieb
Noratrieb deleted the plus-one branch November 23, 2022 12:12
@Noratrieb
Noratrieb restored the plus-one branch December 3, 2022 19:44
@Noratrieb
Noratrieb deleted the plus-one branch December 3, 2022 19:48
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

must_use lint: add with overflow

6 participants

@Noratrieb@rustbot@rust-log-analyzer@fee1-dead@bors@jyn514