Merge pull request #19014 from darichey/fix-cfg-macro

Check cfg when collecting macro defs
This commit is contained in:
Lukas Wirth 2025-01-24 13:13:48 +00:00 committed by GitHub
commit a64667f2ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1381,6 +1381,9 @@ impl ExprCollector<'_> {
}
}
ast::Stmt::Item(ast::Item::MacroDef(macro_)) => {
if self.check_cfg(&macro_).is_none() {
return;
}
let Some(name) = macro_.name() else {
statements.push(Statement::Item(Item::Other));
return;
@ -1390,6 +1393,9 @@ impl ExprCollector<'_> {
self.collect_macro_def(statements, macro_id);
}
ast::Stmt::Item(ast::Item::MacroRules(macro_)) => {
if self.check_cfg(&macro_).is_none() {
return;
}
let Some(name) = macro_.name() else {
statements.push(Statement::Item(Item::Other));
return;