rust-lang / rust-lang/rust

Having <s> in docs causes the rest of the page to be struck-through

Open
#158,725 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug T-rustdoc T-rustdoc-frontend
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Code

Original code can be found here: https://github.com/Thomasdezeeuw/heph/blob/5b8f38814162abb1bf344ec659c449f99e79f2f7/rt/src/scheduler/mod.rs#L218 (used for the screenshot below).

A minimal case would be:

struct T {
    /// <S>
    field: (),
}

Reproduction Steps

  • cargo doc
  • Open the relevant documentation page (or use --open).

Expected Outcome

The documentation/dom elements outside of the documentation of the field not to be stroked-through.

Actual Output

Rustdoc throws a warning indicating the error, but the end result is still somewhat unexpected.

warning: unclosed HTML tag `S`
   --> rt/src/scheduler/mod.rs:203:9
    |
203 |     /// <S>
    |         ^^^
    |
    = note: `#[warn(rustdoc::invalid_html_tags)]` on by default
Image

Version

rustdoc 1.98.0-nightly (ce9954c0c 2026-06-26)

Additional Details

I think this a low priority issue, not solving this perfectly fine in my opinion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with cargo doc using the minimal Rust example and inspect the generated documentation page. Trace rustdoc's handling of the unclosed HTML tag, then add a regression test and verify that text after is no longer struck through while the warning behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.