diff options
| author | bors <bors@rust-lang.org> | 2018-06-27 11:20:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-27 11:20:16 +0000 |
| commit | 142c98dd5a9fbd60c13e62a5c1358a40ee622dbb (patch) | |
| tree | 903290645b3895b243b4bef0a1ffc794f793ebee /src/libsyntax_ext | |
| parent | c20824323cf7ed6ad95cb8d7b780a7934927a753 (diff) | |
| parent | d347270e0c241823d6e3333060f5ee902fffee6a (diff) | |
| download | rust-142c98dd5a9fbd60c13e62a5c1358a40ee622dbb.tar.gz rust-142c98dd5a9fbd60c13e62a5c1358a40ee622dbb.zip | |
Auto merge of #51496 - petrochenkov:mhelper2, r=nikomatsakis
Implement `#[macro_export(local_inner_macros)]` (a solution for the macro helper import problem) Implement a solution for the macro helper issue discussed in https://github.com/rust-lang/rust/issues/35896 as described in https://github.com/rust-lang/rust/issues/35896#issuecomment-395977901. Macros exported from libraries can be marked with `#[macro_export(local_inner_macros)]` and this annotation changes how nested macros in them are resolved. If we have a fn-like macro call `ident!(...)` and `ident` comes from a `macro_rules!` macro marked with `#[macro_export(local_inner_macros)]` then it's replaced with `$crate::ident!(...)` and resolved as such (`$crate` gets the same context as `ident`).
Diffstat (limited to 'src/libsyntax_ext')
| -rw-r--r-- | src/libsyntax_ext/lib.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax_ext/proc_macro_registrar.rs | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index af3ef181c59..31125183266 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -76,6 +76,7 @@ pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver, def_info: None, allow_internal_unstable: false, allow_internal_unsafe: false, + local_inner_macros: false, unstable_feature: None, edition: hygiene::default_edition(), }); @@ -132,6 +133,7 @@ pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver, def_info: None, allow_internal_unstable: true, allow_internal_unsafe: false, + local_inner_macros: false, unstable_feature: None, edition: hygiene::default_edition(), }); diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs index ee343e47bd8..ef29e5a6b02 100644 --- a/src/libsyntax_ext/proc_macro_registrar.rs +++ b/src/libsyntax_ext/proc_macro_registrar.rs @@ -368,6 +368,7 @@ fn mk_registrar(cx: &mut ExtCtxt, format: MacroAttribute(Symbol::intern("proc_macro")), allow_internal_unstable: true, allow_internal_unsafe: false, + local_inner_macros: false, edition: hygiene::default_edition(), }); let span = DUMMY_SP.apply_mark(mark); |
