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

Do not lint assertions_on_constants for const _: () = assert!(expr) #11966

Merged
merged 2 commits into from Dec 17, 2023

Conversation

StackOverflowExcept1on
Copy link
Contributor

@StackOverflowExcept1on StackOverflowExcept1on commented Dec 15, 2023

Fixes #8159

pub fn f() {
    // warning
    assert!(true);
    assert!(usize::BITS >= 32);

    // ok
    const _: () = assert!(usize::BITS >= 32);
}

changelog: Fix const _: () = assert!(expr) false positive on assertions_on_constants lint

@rustbot
Copy link
Collaborator

rustbot commented Dec 15, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Jarcho (or someone else) soon.

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 the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Dec 15, 2023
@Jarcho
Copy link
Contributor

Jarcho commented Dec 17, 2023

Thank you. @bors r+

@bors
Copy link
Collaborator

bors commented Dec 17, 2023

📌 Commit 90ece56 has been approved by Jarcho

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Dec 17, 2023

⌛ Testing commit 90ece56 with merge dd857f8...

@bors
Copy link
Collaborator

bors commented Dec 17, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Jarcho
Pushing dd857f8 to master...

@CAD97
Copy link
Contributor

CAD97 commented Jan 13, 2024

This fixed the simple case of const $ident: $type = assert!(...);, but doesn't handle any nesting (e.g. = { assert!(...); };) yet. repro in issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

False positive assertions_on_constants
5 participants