Merge #1928
1928: Support `#[cfg(..)]` r=matklad a=oxalica This PR implement `#[cfg(..)]` conditional compilation. It read default cfg options from `rustc --print cfg` with also hard-coded `test` and `debug_assertion` enabled. Front-end settings are **not** included in this PR. There is also a known issue that inner control attributes are totally ignored. I think it is **not** a part of `cfg` and create a separated issue for it. #1949 Fixes #1920 Related: #1073 Co-authored-by: uHOOCCOOHu <hooccooh1896@gmail.com> Co-authored-by: oxalica <oxalicc@pm.me>
This commit is contained in:
@@ -1962,6 +1962,7 @@ impl AstNode for ModuleItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
impl ast::AttrsOwner for ModuleItem {}
|
||||
impl ModuleItem {}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Name {
|
||||
|
||||
@@ -397,7 +397,8 @@ Grammar(
|
||||
),
|
||||
"ModuleItem": (
|
||||
enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
|
||||
"UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
|
||||
"UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ],
|
||||
traits: ["AttrsOwner"]
|
||||
),
|
||||
"ImplItem": (
|
||||
enum: ["FnDef", "TypeAliasDef", "ConstDef"]
|
||||
|
||||
Reference in New Issue
Block a user