Some crates (even
std) provide APIs with
*_unchecked() functions. Those usually omit validity checks for the sake of performance. However, those functions can corrupt the data model and cause errors later if not used correctly.
Wouldn't it be nice to have a
#[must_comment] attribute for such functions? The attribute should work similar to
#[must_use]: The compiler throws a warning (or error) if a tagged function is called (outside the defining crate?) without providing a comment (
//). This way a crate could enforce to comment on the use of such potentially dangerous (not necessarily
unsafe ) functions.