about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-23 16:59:13 +0000
committerbors <bors@rust-lang.org>2025-07-23 16:59:13 +0000
commit29a58723b05d004c2e19ddcf2be80d514401f22e (patch)
tree8805c7e6747f15680624530670d284f7bb22dd80 /compiler/rustc_resolve/src
parent4ff3fa01cbdd468851b1b859541ee1c648cde7de (diff)
parentd444815a31c9ed80e90dfd80f8dd371c915bfafd (diff)
downloadrust-29a58723b05d004c2e19ddcf2be80d514401f22e.tar.gz
rust-29a58723b05d004c2e19ddcf2be80d514401f22e.zip
Auto merge of #144360 - matthiaskrgr:rollup-b6ej0mm, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#144173 (Remove tidy checks for `tests/ui/issues/`)
 - rust-lang/rust#144234 (Fix broken TLS destructors on 32-bit win7)
 - rust-lang/rust#144239 (Clean `rustc/parse/src/lexer` to improve maintainability)
 - rust-lang/rust#144256 (Don't ICE on non-TypeId metadata within TypeId)
 - rust-lang/rust#144290 (update tests/ui/SUMMARY.md)
 - rust-lang/rust#144292 (mbe: Use concrete type for `get_unused_rule`)
 - rust-lang/rust#144298 (coverage: Enlarge empty spans during MIR instrumentation, not codegen)
 - rust-lang/rust#144311 (Add powerpc64le-unknown-linux-musl to CI rustc targets)
 - rust-lang/rust#144315 (bootstrap: add package.json and package-lock.json to dist tarball)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/macros.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs
index 77ef7f56c09..333fc808d1b 100644
--- a/compiler/rustc_resolve/src/macros.rs
+++ b/compiler/rustc_resolve/src/macros.rs
@@ -1,6 +1,7 @@
 //! A bunch of methods and structures more or less related to resolving macros and
 //! interface provided by `Resolver` to macro expander.
 
+use std::any::Any;
 use std::cell::Cell;
 use std::mem;
 use std::sync::Arc;
@@ -13,10 +14,10 @@ use rustc_expand::base::{
     Annotatable, DeriveResolution, Indeterminate, ResolverExpand, SyntaxExtension,
     SyntaxExtensionKind,
 };
-use rustc_expand::compile_declarative_macro;
 use rustc_expand::expand::{
     AstFragment, AstFragmentKind, Invocation, InvocationKind, SupportsMacroExpansion,
 };
+use rustc_expand::{MacroRulesMacroExpander, compile_declarative_macro};
 use rustc_hir::def::{self, DefKind, Namespace, NonMacroAttrKind};
 use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
 use rustc_middle::middle::stability;
@@ -357,8 +358,12 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
             let SyntaxExtensionKind::LegacyBang(ref ext) = m.ext.kind else {
                 continue;
             };
+            let ext: &dyn Any = ext.as_ref();
+            let Some(m) = ext.downcast_ref::<MacroRulesMacroExpander>() else {
+                continue;
+            };
             for arm_i in unused_arms.iter() {
-                if let Some((ident, rule_span)) = ext.get_unused_rule(arm_i) {
+                if let Some((ident, rule_span)) = m.get_unused_rule(arm_i) {
                     self.lint_buffer.buffer_lint(
                         UNUSED_MACRO_RULES,
                         node_id,