diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-08-04 03:37:14 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-08-06 23:22:31 +0300 |
| commit | cb64672e0cfccb6d447fddd0ca3e74d0f1de542f (patch) | |
| tree | 2b83af8fab8487985672bbdeaeefa6719c1e8e0a /src/libsyntax | |
| parent | f60d96a4773db747aef75014ef6b41b39ae92372 (diff) | |
| download | rust-cb64672e0cfccb6d447fddd0ca3e74d0f1de542f.tar.gz rust-cb64672e0cfccb6d447fddd0ca3e74d0f1de542f.zip | |
Enable macro modularization implicitly if one of "advanced" macro features is enabled
Do not mark all builtin attributes as used when macro modularization is enabled
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 3f4ee834256..a7a29edf0a0 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -83,10 +83,14 @@ macro_rules! declare_features { } pub fn use_extern_macros(&self) -> bool { - // The `decl_macro`, `tool_attributes` and `custom_attributes` - // features imply `use_extern_macros`. + // A number of "advanced" macro features enable + // macro modularization (`use_extern_macros`) implicitly. self.use_extern_macros || self.decl_macro || - self.tool_attributes || self.custom_attribute + self.tool_attributes || self.custom_attribute || + self.macros_in_extern || self.proc_macro_path_invoc || + self.proc_macro_mod || self.proc_macro_expr || + self.proc_macro_non_items || self.proc_macro_gen || + self.stmt_expr_attributes } } }; @@ -700,7 +704,7 @@ pub fn is_builtin_attr_name(name: ast::Name) -> bool { } pub fn is_builtin_attr(attr: &ast::Attribute) -> bool { - BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.check_name(builtin_name)) || + BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.path == builtin_name) || attr.name().as_str().starts_with("rustc_") } |
