You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
assertions_on_constants should not trigger inside const blocks #12847
As of #11966, assertions_on_constants does not trigger for const _: () = assert!(expr).
In recent Rust versions, this can be more nicely written as const { assert!(expr) }.
IMO assertions in const blocks should be exempted from assertions_on_constants, because generally their entire purpose is to be evaluated at compile time.
warning: `assert!(true)` will be optimized out by the compiler
|
39 | const { assert!(c_int::BITS <= usize::BITS) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove it
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants
= note: `#[warn(clippy::assertions_on_constants)]` on by default
Ah, seems like me searching for the lint name with underscores didn't surface the existing issue which hat the lint name with hyphens. Closing this one, then.
Activity
tesuji commentedon May 26, 2024
duplicate of #12816
PR #12840
TimNN commentedon May 26, 2024
Ah, seems like me searching for the lint name with underscores didn't surface the existing issue which hat the lint name with hyphens. Closing this one, then.
Auto merge of #12840 - tesuji:const-asserts, r=llogiq
Auto merge of #12840 - tesuji:const-asserts, r=llogiq