add rustc_macro_edition_2021

This commit is contained in:
Jana Dönszelmann 2025-03-19 17:29:31 +01:00
parent c4b38a5967
commit 7c085f7ffd
No known key found for this signature in database
10 changed files with 55 additions and 8 deletions

View file

@ -191,6 +191,7 @@ pub enum AttributeKind {
},
MacroTransparency(Transparency),
Repr(ThinVec<(ReprAttr, Span)>),
RustcMacroEdition2021,
Stability {
stability: Stability,
/// Span of the `#[stable(...)]` or `#[unstable(...)]` attribute

View file

@ -182,21 +182,18 @@ macro_rules! find_attr {
}};
($attributes_list: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
fn check_attribute_iterator<'a>(_: &'_ impl IntoIterator<Item = &'a rustc_hir::Attribute>) {}
check_attribute_iterator(&$attributes_list);
let find_attribute = |iter| {
'done: {
for i in $attributes_list {
let i: &rustc_hir::Attribute = i;
match i {
rustc_hir::Attribute::Parsed($pattern) $(if $guard)? => {
return Some($e);
break 'done Some($e);
}
_ => {}
}
}
None
};
find_attribute($attributes_list)
}
}};
}