undocumented_unsafe_blocks lints on documented unsafe blocks that constitute the body of a const in an impl block.
I get the expected behaviour if I put both the unsafe block and the safety comment into a block expression, or if I remove the item from the impl block.
error: unsafe block missing a safety comment
--> continuate-error\src\lib.rs:20:29
|
20 | const DUMMY: SourceId = unsafe { SourceId(NonZeroU64::new_unchecked(1)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding a safety comment on the preceding line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks
= note: requested on the command line with `-D clippy::undocumented-unsafe-blocks`
Summary
undocumented_unsafe_blocks
lints on documentedunsafe
blocks that constitute the body of aconst
in animpl
block.I get the expected behaviour if I put both the unsafe block and the safety comment into a block expression, or if I remove the item from the
impl
block.Lint Name
undocumented_unsafe_blocks
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No output.
Version
Additional Labels
No response