Commit c9e8521
committed
Add
Detect build-time assertions that can use a stronger form and suggest
the strongest applicable one.
The new lint classifies assertion conditions as `build_assert!`,
`const_assert!`, or `static_assert!` depending on whether they depend
on runtime values, generic compile-time context, or only closed
compile-time context.
Using that classification, it warns for:
- `build_assert!` -> `const_assert!`
- `build_assert!` -> `static_assert!`
- `const_assert!` -> `static_assert!`
This keeps diagnostics aligned with the documented assertion hierarchy
by preferring the earliest and most robust assertion form available.
Add `#![allow(klint::assert_hierarchy)]` in `tests/ui/build_error.rs`
and re-bless the test so that test remains focused.
Signed-off-by: Mohamad Alsadhan <mo@sdhn.cc>assert_hierarchy lint1 parent d2e149c commit c9e8521
4 files changed
Lines changed: 506 additions & 7 deletions
0 commit comments