Skip to content
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

Refactor must_use lint into two parts #104359

Merged
merged 1 commit into from
Nov 23, 2022
Merged

Conversation

Noratrieb
Copy link
Member

@Noratrieb Noratrieb commented Nov 13, 2022

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
Collaborator

rustbot commented Nov 13, 2022

r? @fee1-dead

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

@rustbot rustbot 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
@rust-log-analyzer

This comment has been minimized.

@Noratrieb Noratrieb changed the title Remove + 1 on pluralization count from must_use lint Refactor must_use lint into two parts Nov 17, 2022
@Noratrieb
Copy link
Member Author

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
Member

@rustbot author please fix CI

@rustbot rustbot 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
Member Author

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
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 20, 2022

📌 Commit 4e9ceef has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors 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.

fixes rust-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.

fixes rust-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.

fixes rust-lang#104352
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:master Nov 23, 2022
@rustbot rustbot 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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