Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/mbe/src/expander.rs')
| -rw-r--r-- | crates/mbe/src/expander.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/mbe/src/expander.rs b/crates/mbe/src/expander.rs index f910f9f9d7..507402197e 100644 --- a/crates/mbe/src/expander.rs +++ b/crates/mbe/src/expander.rs @@ -9,17 +9,26 @@ use intern::Symbol; use rustc_hash::FxHashMap; use span::{Edition, Span}; -use crate::{ExpandError, ExpandErrorKind, ExpandResult, MatchedArmIndex, parser::MetaVarKind}; +use crate::{ + ExpandError, ExpandErrorKind, ExpandResult, MacroCallStyle, MatchedArmIndex, + parser::MetaVarKind, +}; pub(crate) fn expand_rules( rules: &[crate::Rule], input: &tt::TopSubtree<Span>, marker: impl Fn(&mut Span) + Copy, + call_style: MacroCallStyle, call_site: Span, def_site_edition: Edition, ) -> ExpandResult<(tt::TopSubtree<Span>, MatchedArmIndex)> { let mut match_: Option<(matcher::Match<'_>, &crate::Rule, usize)> = None; for (idx, rule) in rules.iter().enumerate() { + // Skip any rules that aren't relevant to the call style (fn-like/attr/derive). + if call_style != rule.style { + continue; + } + let new_match = matcher::match_(&rule.lhs, input, def_site_edition); if new_match.err.is_none() { |