{"record":{"id":"f3fcce4a723871d2","repo":"rust-lang/rust","slug":"no-encoded-attributes-for-a-structure-or-variant","errorCode":null,"errorMessage":"no encoded attributes for a structure or variant","messagePattern":"no encoded attributes for a structure or variant","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler/rustc_metadata/src/rmeta/decoder.rs","lineNumber":1458,"sourceCode":"    ) -> impl Iterator<Item = hir::Attribute> {\n        self.root\n            .tables\n            .attributes\n            .get(self, id)\n            .unwrap_or_else(|| {\n                let def_key = self.def_key(id);\n                match def_key.disambiguated_data.data {\n                    DefPathData::Ctor => {\n                        // Structure and variant constructors don't have any attributes encoded for them,\n                        // but we assume that someone passing a constructor ID actually wants to look at\n                        // the attributes on the corresponding struct or variant.\n                        assert_eq!(def_key.disambiguated_data.data, DefPathData::Ctor);\n                        let parent_id = def_key.parent.expect(\"no parent for a constructor\");\n                        self.root\n                            .tables\n                            .attributes\n                            .get(self, parent_id)\n                            .expect(\"no encoded attributes for a structure or variant\")\n                    }\n                    DefPathData::SyntheticCoroutineBody => {\n                        // SyntheticCoroutineBodies cannot have attributes\n                        LazyArray::default()\n                    }\n                    _ => panic!(\"Definition key {def_key:?} of type `{:?}` did not have any attributes stored\", def_key.disambiguated_data.data)\n                }\n            })\n            .decode((self, tcx))\n    }\n\n    fn get_inherent_implementations_for_type<'tcx>(\n        &self,\n        tcx: TyCtxt<'tcx>,\n        id: DefIndex,\n    ) -> &'tcx [DefId] {\n        tcx.arena.alloc_from_iter(\n            self.root","sourceCodeStart":1440,"sourceCodeEnd":1476,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_metadata/src/rmeta/decoder.rs#L1440-L1476","documentation":"Fires immediately after 285, in the same `get_item_attrs` branch (decoder.rs:1458). Once the constructor's parent struct/variant is found, the decoder expects that parent to have an `attributes` table entry; `.expect(\"no encoded attributes for a structure or variant\")` panics when it does not. The invariant is that every struct/variant carries an (possibly empty) encoded attribute list.","triggerScenarios":"The parent struct/variant of a constructor was encoded without an `attributes` slot; schema drift where attributes moved tables; metadata corruption.","commonSituations":"Toolchain version mismatch between encoder and decoder; incremental cache reuse after attribute-table layout changes; a struct/variant with no attributes encoded by a path that skipped the (empty) entry.","solutions":["`cargo clean` and rebuild to re-encode the attribute table for the current schema.","Align all crates on one rustc version.","Rebuild the specific dependency that owns the struct/variant.","Clean-build ICE -> report; the encoder omitted the attribute slot for a struct/variant."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"cargo clean && cargo build  # re-encode the attribute table consistently","typeGuard":null,"tryCatchPattern":"cargo build || { cargo clean && cargo build; }","preventionTips":["Keep the whole crate graph on one rustc version so attribute-table layouts match.","`cargo clean` after upgrading the compiler.","Rebuild dependencies from source rather than reusing cross-version rlibs."],"tags":["metadata","rmeta","decoder","attributes","ice"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}