{"id":"adaec2f6238acefe","repo":"rust-lang/rust","slug":"shouldn-t-exist-here","errorCode":null,"errorMessage":"shouldn't exist here","messagePattern":"shouldn't exist here","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"compiler/rustc_ast_lowering/src/block.rs","lineNumber":74,"sourceCode":"                        expr = Some(e);\n                    } else {\n                        let hir_id = self.lower_node_id(s.id);\n                        self.alias_attrs(hir_id, e.hir_id);\n                        let kind = hir::StmtKind::Expr(e);\n                        let span = self.lower_span(s.span);\n                        stmts.push(hir::Stmt { hir_id, kind, span });\n                    }\n                }\n                StmtKind::Semi(e) => {\n                    let e = self.lower_expr(e);\n                    let hir_id = self.lower_node_id(s.id);\n                    self.alias_attrs(hir_id, e.hir_id);\n                    let kind = hir::StmtKind::Semi(e);\n                    let span = self.lower_span(s.span);\n                    stmts.push(hir::Stmt { hir_id, kind, span });\n                }\n                StmtKind::Empty => {}\n                StmtKind::MacCall(..) => panic!(\"shouldn't exist here\"),\n            }\n            ast_stmts = tail;\n        }\n        (self.arena.alloc_from_iter(stmts), expr)\n    }\n\n    /// Return an `ImplTraitContext` that allows impl trait in bindings if\n    /// the feature gate is enabled, or issues a feature error if it is not.\n    fn impl_trait_in_bindings_ctxt(&self, position: ImplTraitPosition) -> ImplTraitContext {\n        if self.tcx.features().impl_trait_in_bindings() {\n            ImplTraitContext::InBinding\n        } else {\n            ImplTraitContext::FeatureGated(position, sym::impl_trait_in_bindings)\n        }\n    }\n\n    fn lower_local(&mut self, l: &Local) -> &'hir hir::LetStmt<'hir> {\n        // Let statements are allowed to have impl trait in bindings.","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/rust-lang/rust/blob/22057b88b091743bc0fd8d592a9264f0a6951403/compiler/rustc_ast_lowering/src/block.rs#L56-L92","documentation":"Panic in block lowering when a statement of kind StmtKind::MacCall is encountered. After macro expansion completes, statements must be fully expanded — no StmtKind::MacCall should survive into AST lowering. Reaching this panic means lowering was invoked on an un-expanded AST, a violation of the expansion-then-lowering pipeline invariant.","triggerScenarios":"Triggered when lower_block (or related lowering entry points) is called on a crate/block that has not been through macro expansion — e.g. a direct invocation of the AST-lowering pass on raw parsed AST, a compiler refactor that skips expansion, or a proc-macro/tool that feeds unexpanded stmts into lowering. Also seen after nightly regressions in the expansion driver.","commonSituations":"Nightly rustc regressions in macro expansion; compiler-internals tooling that bypasses the expansion phase; fuzzers exercising lowering directly. Ordinary user code with macro invocations is expanded first and never reaches this path.","solutions":["Report the ICE to rust-lang/rust with the source and rustc version.","If invoking rustc internals directly, ensure the expansion pass runs before ast_lowering.","Bisect nightlies to find the regression commit in the expansion/lowering pipeline.","Minimize the macro usage that triggers the unexpanded statement reaching lowering."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// block.rs lowers StmtKind::MacCall only BEFORE macro expansion; reaching\n// lowering with a MacCall statement means expansion was incomplete.\n// Validate that no statement in the block is still a MacCall:\nfn fully_expanded(block: &ast::Block) -> bool {\n    block.stmts.iter().all(|s| !matches!(s.kind, ast::StmtKind::MacCall(_)))\n}\nif !fully_expanded(&block) {\n    return Err(\"block contains an unexpanded macro call; run expansion to fixed point first\");\n}","typeGuard":"fn is_lowerable_stmt(s: &ast::Stmt) -> bool {\n    !matches!(s.kind, ast::StmtKind::MacCall(_))\n}","tryCatchPattern":"let lowered = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| lower_block(&block)));\nmatch lowered {\n    Ok(hir_block) => hir_block,\n    Err(_) => return Err(\"block lowering panicked: macro call statement survived into lowering\"),\n}","preventionTips":["If you drive expansion manually (proc-macro server, rust-analyzer), run macro expansion to a true fixed point before invoking AST lowering — a leftover MacCall is a symptom of an early-exit in expansion.","Never splice a raw macro call expression into a statement position and bypass the expander; expand it to its output first.","In generated AST, prefer emitting the already-expanded statement form rather than a MacCall node that the compiler must expand.","Check for `StmtKind::MacCall` presence as a post-expansion sanity assertion in any pipeline that feeds rustc_ast_lowering."],"tags":["rustc","ice","ast-lowering","macro-expansion","block"],"analyzedSha":"22057b88b091743bc0fd8d592a9264f0a6951403","analyzedAt":"2026-08-03T08:09:25.915Z","schemaVersion":2}