rust-lang/rust · error
no resolutions for a doc link
Error message
no resolutions for a doc link
What it means
Fires in `get_doc_link_resolutions` (decoder.rs:1924). Rustdoc encodes, per definition, the resolution of intra-doc links so downstream doc builds can reuse them; the decoder `.expect()`s an entry in the `doc_link_resolutions` table. A missing entry means a definition was queried for doc-link resolutions that never had them encoded.
Source
Thrown at compiler/rustc_metadata/src/rmeta/decoder.rs:1924
}
})
.clone()
}
fn get_attr_flags(&self, index: DefIndex) -> AttrFlags {
self.root.tables.attr_flags.get(self, index)
}
fn get_intrinsic(&self, tcx: TyCtxt<'_>, index: DefIndex) -> Option<ty::IntrinsicDef> {
self.root.tables.intrinsic.get(self, index).map(|d| d.decode((self, tcx)))
}
fn get_doc_link_resolutions(&self, tcx: TyCtxt<'_>, index: DefIndex) -> DocLinkResMap {
self.root
.tables
.doc_link_resolutions
.get(self, index)
.expect("no resolutions for a doc link")
.decode((self, tcx))
}
fn get_doc_link_traits_in_scope(
&self,
tcx: TyCtxt<'_>,
index: DefIndex,
) -> impl Iterator<Item = DefId> {
self.root
.tables
.doc_link_traits_in_scope
.get(self, index)
.expect("no traits in scope for a doc link")
.decode((self, tcx))
}
}
impl CrateMetadata {View on GitHub (pinned to 7088e4b63a)
Solutions
- `cargo clean` and run `cargo doc` from scratch so doc metadata is encoded consistently.
- Build dependencies with doc metadata enabled (avoid `--no-deps` for the crates you document).
- Align toolchain versions across the doc build graph.
- Clean-build doc ICE -> file against rustdoc with the crate that triggers the link resolution query.
Defensive patterns
Strategy: validation
Validate before calling
# Ensure dependencies carry doc metadata before running cargo doc cargo clean cargo doc --document-private-items # builds deps with doc metadata
Try / catch
cargo doc || { cargo clean && cargo doc; } Prevention
- Do not share a `target/` between `cargo build` and `cargo doc` without cleaning.
- Keep doc flags (`RUSTDOCFLAGS`) consistent across the doc build graph.
- Avoid `--no-deps` for crates whose intra-doc links you need to resolve.
When it happens
Trigger: Running `cargo doc` on a crate whose dependency was compiled without doc metadata (`--no-deps`, or built as a non-doc rlib) but is now being asked for doc-link resolutions; cross-version reuse where the doc-link table layout changed; querying resolutions for a definition that is not a doc-link target.
Common situations: Mixing `cargo build` artifacts with `cargo doc` runs in a shared `target/`; dependency built without `--cfg docsrs` / doc metadata; toolchain drift.
Related errors
- no traits in scope for a doc link
- no encoded ident for item
- variants are not encoded for an enum
- provided `DefIndex` must refer to a module-like item
- argument names not encoded for a function
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/1c63776742d7bc50.
Report an issue: GitHub.