Skip to content

undocumented_unsafe_blocks false positive on consts #11246

@jhpratt

Description

@jhpratt

Summary

See repro, as it's self-explanatory.

Lint Name

undocumented_unsafe_blocks

Reproducer

#![deny(clippy::undocumented_unsafe_blocks)]

// Safety: foo
const _: () = unsafe {};

The lint fires, but it should not, as a safety comment is present on the preceding line. This is the case regardless of configuration.

Version

rustc 1.73.0-nightly (500647fd8 2023-07-27)
binary: rustc
commit-hash: 500647fd8138cc09e87edb08d62f81654fbf6ef8
commit-date: 2023-07-27
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions