From 40ac87e2995d3ccfea94bc02741069750b1c166c Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 10 Mar 2026 13:51:41 +0000 Subject: [PATCH] Mark an unreachable match arm as such Synchronize which elements have code paths and which are unreachable betwen def collector and build reduced graph --- compiler/rustc_resolve/src/build_reduced_graph.rs | 4 +++- compiler/rustc_resolve/src/def_collector.rs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index a280acc0d51d..80538aebf5f6 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -1474,7 +1474,9 @@ fn visit_assoc_item(&mut self, item: &'a AssocItem, ctxt: AssocCtxt) { return; } - AssocItemKind::DelegationMac(..) => bug!(), + AssocItemKind::DelegationMac(..) => { + span_bug!(item.span, "delegation mac should already have been removed") + } }; let vis = self.resolve_visibility(&item.vis); let feed = self.r.feed(item.id); diff --git a/compiler/rustc_resolve/src/def_collector.rs b/compiler/rustc_resolve/src/def_collector.rs index 81820e049716..de36f01b6d0e 100644 --- a/compiler/rustc_resolve/src/def_collector.rs +++ b/compiler/rustc_resolve/src/def_collector.rs @@ -358,9 +358,12 @@ fn visit_assoc_item(&mut self, i: &'a AssocItem, ctxt: visit::AssocCtxt) { }, ), AssocItemKind::Type(box TyAlias { ident, .. }) => (*ident, DefKind::AssocTy), - AssocItemKind::MacCall(..) | AssocItemKind::DelegationMac(..) => { + AssocItemKind::MacCall(..) => { return self.visit_macro_invoc(i.id); } + AssocItemKind::DelegationMac(..) => { + span_bug!(i.span, "degation mac invoc should have already been handled") + } }; let def = self.create_def(i.id, Some(ident.name), def_kind, i.span);