Closed
Description
In #72188, an allow-by-default lint was added against #[no_mangle]
, which previously permitted unsafety even in the event that #![forbid(unsafe_code)]
was used.
I think it'd be a good idea to collect a list of all such "unsafe attributes" and try to add similar lints for them on a case-by-case basis. This shouldn't be terribly difficult to do by extracting them from the Built-in attributes index from the Rust Reference.
I've started a list below. Please leave comments and I'll update it (or anyone else who has the power to do so, feel free). Items in the list with strikethrough are deemed out-of-scope.
ABI, linking, symbols, and FFI
-
link
-
link_ordinal
-
(see Tracking issue forlink_args
link_args
stabilization #29596) -
(see this comment)link_name
-
(see this comment)repr
-
repr(packed)
-
-
export_name
(Add an allow-by-default lint against #[no_mangle] #72188, Add checking for no_mangle to unsafe_code lint #72209) -
link_section
(Report unsafe for overriding link sections #97086) -
no_mangle
(Add an allow-by-default lint against #[no_mangle] #72188, Add checking for no_mangle to unsafe_code lint #72209) -
(see this comment)used
Others?
Please leave comments with suggestions or corrections.