diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-20 11:52:31 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-26 13:09:54 +0300 |
| commit | 8eaf17bca2674293eba0ea10056d5c77b6352086 (patch) | |
| tree | a726739d50e26b0142be28425b154446f43e4fe5 /src/libsyntax | |
| parent | 4268e7ee22935f086b856ef0063a9e22b49aeddb (diff) | |
| download | rust-8eaf17bca2674293eba0ea10056d5c77b6352086.tar.gz rust-8eaf17bca2674293eba0ea10056d5c77b6352086.zip | |
Introduce built-in macros through libcore
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 11b7a984aaa..0ab14bee160 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -592,6 +592,9 @@ pub struct SyntaxExtension { pub helper_attrs: Vec<Symbol>, /// Edition of the crate in which this macro is defined. pub edition: Edition, + /// Built-in macros have a couple of special properties (meaning of `$crate`, + /// availability in `#[no_implicit_prelude]` modules), so we have to keep this flag. + pub is_builtin: bool, } impl SyntaxExtensionKind { @@ -636,6 +639,7 @@ impl SyntaxExtension { deprecation: None, helper_attrs: Vec::new(), edition, + is_builtin: false, kind, } } @@ -687,7 +691,7 @@ pub trait Resolver { fn resolve_dollar_crates(&mut self); fn visit_ast_fragment_with_placeholders(&mut self, expn_id: ExpnId, fragment: &AstFragment, derives: &[ExpnId]); - fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc<SyntaxExtension>); + fn register_builtin_macro(&mut self, ident: ast::Ident, ext: SyntaxExtension); fn resolve_imports(&mut self); diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 4503cea0f10..c76e964b5e7 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -437,6 +437,7 @@ pub fn compile( deprecation: attr::find_deprecation(&sess, &def.attrs, def.span), helper_attrs: Vec::new(), edition, + is_builtin: attr::contains_name(&def.attrs, sym::rustc_builtin_macro), } } |
