{"record":{"id":"b012dc0c61c96047","repo":"pydantic/monty","slug":"unreachable","errorCode":null,"errorMessage":"unreachable","messagePattern":"unreachable","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/monty-apidoc/src/render.rs","lineNumber":191,"sourceCode":"        let mut traits: Vec<String> = Vec::new();\n        for impl_id in impls {\n            let impl_item = &self.krate.index[impl_id];\n            let ItemEnum::Impl(impl_) = &impl_item.inner else {\n                continue;\n            };\n            match &impl_.trait_ {\n                None => inherent.push(impl_item),\n                Some(trait_) => {\n                    if !impl_.is_synthetic && !impl_.is_negative && impl_.blanket_impl.is_none() {\n                        traits.push(to_plain(&self.sig().path_str(trait_)));\n                    }\n                }\n            }\n        }\n        inherent.sort_by_key(|item| item.span.as_ref().map(|s| (s.filename.clone(), s.begin)));\n        for impl_item in inherent {\n            let ItemEnum::Impl(impl_) = &impl_item.inner else {\n                unreachable!()\n            };\n            self.render_methods(out, name, impl_, level);\n        }\n        traits.sort();\n        traits.dedup();\n        if !traits.is_empty() {\n            let list: Vec<String> = traits.iter().map(|t| format!(\"`{t}`\")).collect();\n            writeln!(out, \"\\nImplements: {}.\", list.join(\", \")).unwrap();\n        }\n    }\n\n    /// The methods (and associated consts) of one inherent impl block.\n    fn render_methods(&self, out: &mut String, type_name: &str, impl_: &Impl, level: usize) {\n        for method_id in &impl_.items {\n            let method = &self.krate.index[method_id];\n            let Some(method_name) = method.name.as_deref() else {\n                continue;\n            };","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/pydantic/monty/blob/adc986b362e3961f407868cb118a99fe831b9e61/crates/monty-apidoc/src/render.rs#L173-L209","documentation":"An `unreachable!()` panic in monty-apidoc's `render_impls`: items sorted into the `inherent` bucket are assumed to be `ItemEnum::Impl` rustdoc items. If any other item kind lands in that bucket, the assumption is broken. This affects documentation rendering only, not the interpreter.","triggerScenarios":"Rendering API docs when a rustdoc JSON item grouped as `inherent` is not an `Impl` — e.g. after a rustdoc-json format change or a mis-filtered match arm upstream in `render_impls`.","commonSituations":"Hit when regenerating docs (`make generate-api-docs`) after a rustc/rustdoc-json version bump that adds new ItemEnum variants or changes impl grouping.","solutions":["Update the match/filter in `render_impls` to handle the new rustdoc JSON item kind.","Pin or update rustdoc-json-related tooling to a version consistent with the parser in monty-apidoc.","Run `make generate-api-docs` locally on the failing rustc version and inspect the unexpected item."],"exampleFix":"// before\nlet ItemEnum::Impl(impl_) = &impl_item.inner else {\n    unreachable!()\n};\n// after\nlet ItemEnum::Impl(impl_) = &impl_item.inner else {\n    continue; // skip non-impl items gracefully\n};","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Treat non-impl inherent items as skippable instead of panicking\nlet Some(impl_) = match &impl_item.inner {\n    ItemEnum::Impl(i) => Some(i),\n    _ => None,\n} else { continue };","preventionTips":["Re-run `make generate-api-docs` after every rustc upgrade and fix fallout immediately.","Handle unknown rustdoc-json ItemEnum variants with a logged skip, not a panic.","Keep monty-apidoc's rustdoc-json expectations in sync with the toolchain version in CI."],"tags":["rust","internal-error","panic","documentation","rustdoc-json"],"backgroundTag":"internal-invariant-violation","analyzedSha":"adc986b362e3961f407868cb118a99fe831b9e61","analyzedAt":"2026-09-13T19:19:18.698Z","contentChangedAt":"2026-09-13T19:19:18.698Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}