Open
Description
Code
#[warn(rustdoc::unescaped_backticks)]
pub fn foo() {}
#[doc = "`"]
pub fn bar() {}
Current output
[none]
Desired output
warning: unescaped backtick
--> src/lib.rs:5:10
|
5 | #[doc = "`"]
| ^
|
= help: the opening or closing backtick of an inline code may be missing
= help: if you meant to use a literal backtick, escape it
change: `
to this: \`
note: the lint level is defined here
--> src/lib.rs:1:8
|
1 | #[warn(rustdoc::unescaped_backticks)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Rationale and extra context
No response
Other cases
Rust Version
rustc 1.89.0-nightly (70b3f4666 2025-05-30)
binary: rustc
commit-hash: 70b3f4666e24ce22fc32f5e357dbcf85d3254e63
commit-date: 2025-05-30
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5
Anything else?
removing fn foo
causes the warning to be emitted properly.
also works with regular doc comments, and even if the first item is not public.