Skip to content

Commit b157b15

Browse files
committed
Add assert_hierarchy lint
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>
1 parent d2e149c commit b157b15

File tree

4 files changed

+486
-7
lines changed

4 files changed

+486
-7
lines changed

0 commit comments

Comments
 (0)