Skip to content

rustdoc does not detect broken markdown due to missing links (except for links without a space) #141227

Open
@RalfJung

Description

@RalfJung

I changed [allocated object] to [allocation] in docs, and strangely that triggered an error. Turns out the docs had a broken link, which you can see live at https://doc.rust-lang.org/1.87.0/std/primitive.pointer.html#method.split_at_mut_unchecked (note the "[allocated object]") -- but rustdoc somehow wouldn't complain unless the link text has no spaces? Something very strange is going on here.

See #141224 for context. The error emitted after the change is below:

  error: unresolved link to `allocation`
      --> library/core/src/ptr/mut_ptr.rs:1851:54
       |
  1851 |     /// `mid` must be [in-bounds] of the underlying [allocation].
       |                                                      ^^^^^^^^^^ no item named `allocation` in scope
       |
       = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
       = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`
       = help: to override `-D warnings` add `#[allow(rustdoc::broken_intra_doc_links)]`

Possibly related: #130126

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-intra-doc-linksArea: Intra-doc links, the ability to link to items in docs by nameA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions