Open
Description
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
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
fmease commentedon May 18, 2025
Simply put,
[a b c]
is not an intra-doc link "candidate" while[a]
is. The former is just a broken CommonMark shortcut reference link. Arguably, we should do something here though (i.e., emitting some lint).lolbinarycat commentedon May 23, 2025
i actually have a full fix for this up at #132748, but it had to be toned back with some additional heirustics to avoid causing massive code churn, both in std and in the wider ecosystem.
we could split out a more strict allow-by-default lint, but currently the formatting info is stripped away by the time we decide to emit the lint, so it would be non-trivial.