{"record":{"id":"bb0d874f3ba73f86","repo":"rust-lang/rust","slug":"no-traits-in-scope-for-a-doc-link","errorCode":null,"errorMessage":"no traits in scope for a doc link","messagePattern":"no traits in scope for a doc link","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_metadata/src/rmeta/decoder.rs","lineNumber":1937,"sourceCode":"    fn get_doc_link_resolutions(&self, tcx: TyCtxt<'_>, index: DefIndex) -> DocLinkResMap {\n        self.root\n            .tables\n            .doc_link_resolutions\n            .get(self, index)\n            .expect(\"no resolutions for a doc link\")\n            .decode((self, tcx))\n    }\n\n    fn get_doc_link_traits_in_scope(\n        &self,\n        tcx: TyCtxt<'_>,\n        index: DefIndex,\n    ) -> impl Iterator<Item = DefId> {\n        self.root\n            .tables\n            .doc_link_traits_in_scope\n            .get(self, index)\n            .expect(\"no traits in scope for a doc link\")\n            .decode((self, tcx))\n    }\n}\n\nimpl CrateMetadata {\n    pub(crate) fn new(\n        tcx: TyCtxt<'_>,\n        blob: MetadataBlob,\n        root: CrateRoot,\n        raw_proc_macros: Option<&'static [ProcMacroClient]>,\n        cnum: CrateNum,\n        cnum_map: CrateNumMap,\n        dep_kind: CrateDepKind,\n        source: CrateSource,\n        private_dep: bool,\n        host_hash: Option<Svh>,\n    ) -> CrateMetadata {\n        let trait_impls = root","sourceCodeStart":1919,"sourceCodeEnd":1955,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_metadata/src/rmeta/decoder.rs#L1919-L1955","documentation":"Fires in `get_doc_link_traits_in_scope` (decoder.rs:1937), the companion to 288. Rustdoc encodes the list of traits in scope (for method-resolution in intra-doc links) per definition; the decoder `.expect()`s an entry in `doc_link_traits_in_scope`. A missing entry indicates doc metadata was not encoded for that definition or was encoded by an incompatible version.","triggerScenarios":"Documenting a definition whose traits-in-scope were never serialized (dependency built without doc metadata); schema change in the doc-link tables; reusing artifacts across rustdoc versions.","commonSituations":"Shared `target/` between `cargo build` and `cargo doc`; dependency recompiled without doc flags; nightly rustdoc changes to the doc-link encoding.","solutions":["`cargo clean` then `cargo doc` so traits-in-scope are encoded for the current graph.","Ensure all documented dependencies carry doc metadata (remove `--no-deps`, set `RUSTDOCFLAGS=-D rustdoc::broken_intra_doc_links` consistently).","Pin one toolchain for the whole doc build.","Clean-build ICE -> file against rustdoc."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"cargo clean && cargo doc   # re-encode traits-in-scope for the current graph","typeGuard":null,"tryCatchPattern":"cargo doc || { cargo clean && cargo doc; }","preventionTips":["Build the documentation graph with one toolchain and consistent `RUSTDOCFLAGS`.","`cargo clean` before doc builds that follow a toolchain change.","Ensure documented dependencies are compiled with doc metadata."],"tags":["metadata","rmeta","decoder","rustdoc","doc-links","ice"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}