Skip to content

rustdoc::unescaped_backticks only fires on the first item #141827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lolbinarycat opened this issue May 31, 2025 · 0 comments
Open

rustdoc::unescaped_backticks only fires on the first item #141827

lolbinarycat opened this issue May 31, 2025 · 0 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@lolbinarycat
Copy link
Contributor

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.

@lolbinarycat lolbinarycat added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. labels May 31, 2025
@fmease fmease added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. and removed A-diagnostics Area: Messages for errors, warnings, and lints labels May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants