Skip to content

Unsafe attributes support (undocumented_unsafe_blocks) #13316

Open
@ojeda

Description

@ojeda

What it does

Unsafe attributes have been stabilized (rust-lang/rust#128771, rust-lang/rust#123757), thus it would be nice to have a lint that ensures // SAFETY comments are in place.

Since undocumented_unsafe_blocks covers impls too, perhaps it should also cover this too, although it may be best to possibly split them (but that is a different issue).

See #13317 as well.

Advantage

No response

Drawbacks

No response

Example

#[unsafe(no_mangle)]
pub fn f() {}

Should be written as:

// SAFETY: ...
#[unsafe(no_mangle)]
pub fn f() {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions