Skip to content

Support NonZero constants in integer_const 17481 - #17519

Open
arunsingh wants to merge 1 commit into
rust-lang:masterfrom
arunsingh:support-nonzero-in-integer-const-17481
Open

Support NonZero constants in integer_const 17481#17519
arunsingh wants to merge 1 commit into
rust-lang:masterfrom
arunsingh:support-nonzero-in-integer-const-17481

Conversation

@arunsingh

Copy link
Copy Markdown
Contributor

changelog: Improve internal constant evaluation for standard-library NonZero values

Fixes #17481.

Extends clippy_utils::consts::integer_const to read scalar-backed constants whose resolved type is core::num::NonZero<T>, including aliases such as NonZeroU32. General ADT evaluation remains unchanged.

Validation:

  • cargo test -p clippy_utils --lib integer_const
  • cargo dev fmt --check
  • git diff --check
  • cargo check -p clippy_utils
  • cargo check -p clippy_lints
  • cargo dev dogfood
  • cargo test

Signed-off-by: Arun Singh <arunsingh.in@gmail.com>
@rustbot

rustbot commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request. A reviewer will take a look after it receives 2 community reviews.

In the meantime, we would highly appreciate if you could try to review any of PRs waiting on community reviews.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Aug 7, 2026
@arunsingh

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@qdot3

qdot3 commented Aug 8, 2026

Copy link
Copy Markdown

Sorry for the confusion. I was referring to NonZero::BITS in #17481.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend integer_const to cover NonZero type and NonZero* type aliases

3 participants