Skip to content

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Sep 28, 2025

changelog: [assertions_on_constants]: Suggest using a const block when the assertion uses a named constant.

@Jarcho Jarcho added the S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work label Sep 28, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 28, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Sep 30, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Copy link

github-actions bot commented Sep 30, 2025

Lintcheck changes for 61b1f0e

Lint Added Removed Changed
clippy::assertions_on_constants 0 0 1

This comment will be updated if you push new changes

@Jarcho Jarcho force-pushed the const_eval2 branch 5 times, most recently from b51b811 to 2d24b01 Compare September 30, 2025 16:15
@Jarcho Jarcho mentioned this pull request Sep 30, 2025
@Jarcho Jarcho removed the S-blocked Status: marked as blocked ❌ on something else such as an RFC or other implementation work label Sep 30, 2025
@Jarcho
Copy link
Contributor Author

Jarcho commented Sep 30, 2025

This now comes before #15773.

if self.msrv.meets(cx, msrvs::CONST_PANIC) {
(
"this assertion has a constant value",
"consider moving this to an anonymous constant: `const _: () = { assert!(..); }`",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not suggest a const block instead? const { assert!(..); } seems more readable than an unnamed unit constant. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot those are stable.

@samueltardieu
Copy link
Member

r? samueltardieu because of #15773

@rustbot rustbot assigned samueltardieu and unassigned Alexendoo Sep 30, 2025
@samueltardieu samueltardieu added this pull request to the merge queue Sep 30, 2025
@samueltardieu
Copy link
Member

Thanks.

Merged via the queue into rust-lang:master with commit f084864 Sep 30, 2025
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants