diff options
| author | bors <bors@rust-lang.org> | 2016-10-24 23:15:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-24 23:15:59 -0700 |
| commit | affc3b7552324284ccd7042b5b23f6ecd391babc (patch) | |
| tree | 8651a915b3151a8c74996cfc2133effc2a6a133f /src/libsyntax | |
| parent | 7a208648daa5ed2697527e0c6b79c0697f3950d8 (diff) | |
| parent | 5e8951d331b4c1baef83b5b051eb4927c964c02c (diff) | |
| download | rust-affc3b7552324284ccd7042b5b23f6ecd391babc.tar.gz rust-affc3b7552324284ccd7042b5b23f6ecd391babc.zip | |
Auto merge of #37292 - jseyfried:import_macros_in_resolve, r=nrc
Process `#[macro_use]` imports in `resolve` and clean up macro loading Groundwork macro modularization (cc #35896). r? @nrc
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/base.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 5 |
3 files changed, 4 insertions, 7 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 30fc4c3dd80..ae036e66c69 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2012,8 +2012,6 @@ pub struct MacroDef { pub id: NodeId, pub span: Span, pub imported_from: Option<Ident>, - pub export: bool, - pub use_locally: bool, pub allow_internal_unstable: bool, pub body: Vec<TokenTree>, } diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index f3272960e83..c404c6d1162 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -519,7 +519,7 @@ pub trait Resolver { fn get_module_scope(&mut self, id: ast::NodeId) -> Mark; fn visit_expansion(&mut self, mark: Mark, expansion: &Expansion); - fn add_macro(&mut self, scope: Mark, def: ast::MacroDef); + fn add_macro(&mut self, scope: Mark, def: ast::MacroDef, export: bool); fn add_ext(&mut self, ident: ast::Ident, ext: Rc<SyntaxExtension>); fn add_expansions_at_stmt(&mut self, id: ast::NodeId, macros: Vec<Mark>); @@ -541,7 +541,7 @@ impl Resolver for DummyResolver { fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() } fn visit_expansion(&mut self, _invoc: Mark, _expansion: &Expansion) {} - fn add_macro(&mut self, _scope: Mark, _def: ast::MacroDef) {} + fn add_macro(&mut self, _scope: Mark, _def: ast::MacroDef, _export: bool) {} fn add_ext(&mut self, _ident: ast::Ident, _ext: Rc<SyntaxExtension>) {} fn add_expansions_at_stmt(&mut self, _id: ast::NodeId, _macros: Vec<Mark>) {} diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 61911e0d3b3..ceca698f479 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -157,14 +157,13 @@ impl IdentMacroExpander for MacroRulesExpander { tts: Vec<tokenstream::TokenTree>, attrs: Vec<ast::Attribute>) -> Box<MacResult> { + let export = attr::contains_name(&attrs, "macro_export"); let def = ast::MacroDef { ident: ident, id: ast::DUMMY_NODE_ID, span: span, imported_from: None, - use_locally: true, body: tts, - export: attr::contains_name(&attrs, "macro_export"), allow_internal_unstable: attr::contains_name(&attrs, "allow_internal_unstable"), attrs: attrs, }; @@ -176,7 +175,7 @@ impl IdentMacroExpander for MacroRulesExpander { MacEager::items(placeholders::macro_scope_placeholder().make_items()) }; - cx.resolver.add_macro(cx.current_expansion.mark, def); + cx.resolver.add_macro(cx.current_expansion.mark, def, export); result } } |
