expand: Change how #![cfg(FALSE)] behaves on crate root

This commit is contained in:
Lukas Wirth 2023-05-22 21:19:54 +02:00
parent 54129fa113
commit 74d6826858
3 changed files with 14 additions and 5 deletions

View file

@ -309,6 +309,14 @@ impl Attr {
Some(paths)
}
pub fn cfg(&self) -> Option<CfgExpr> {
if *self.path.as_ident()? == crate::name![cfg] {
self.token_tree_value().map(CfgExpr::parse)
} else {
None
}
}
}
pub fn collect_attrs(