This is something that bothers me as well, particularly in the context of #![forbid(unsafe_code)]
, which still allows crate-local unsafe code via these "escape hatches", and therefore provides a misleading sense of what it actually does.
See also unsafe attributes which work in a #![forbid(unsafe_code)]
context, e.g. #[no_mangle]
(and there are many more than that).
Perhaps at an edition boundary #![forbid(unsafe_code)]
could be changed to disallow all of these as well.
Or perhaps things could be take a step farther: at an edition boundary, #![allow(unsafe_code)]
could be required to enable them, as was proposed before here: