about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-18 10:57:05 +0000
committerbors <bors@rust-lang.org>2018-05-18 10:57:05 +0000
commitdf40e61382a2cba0be621fdabb9971ce3475e9a7 (patch)
tree7bdf66599659eccd8b03f5921c2e5087efe94008 /src/libsyntax_ext
parentfd18d2537ddcffb24b3739393b085ed28dfc340e (diff)
parentd8bbc1ee1ad44e9c7bd93c8d59103eacd0ed36e8 (diff)
downloadrust-df40e61382a2cba0be621fdabb9971ce3475e9a7.tar.gz
rust-df40e61382a2cba0be621fdabb9971ce3475e9a7.zip
Auto merge of #50307 - petrochenkov:keyhyg2, r=nikomatsakis
Implement edition hygiene for keywords

Determine "keywordness" of an identifier in its hygienic context.
cc https://github.com/rust-lang/rust/pull/49611

I've resurrected `proc` as an Edition-2015-only keyword for testing purposes, but it should probably be buried again. EDIT: `proc` is removed again.
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/lib.rs5
-rw-r--r--src/libsyntax_ext/proc_macro_registrar.rs3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs
index e100ef29225..15fcfac13ad 100644
--- a/src/libsyntax_ext/lib.rs
+++ b/src/libsyntax_ext/lib.rs
@@ -54,6 +54,7 @@ pub mod proc_macro_impl;
 use rustc_data_structures::sync::Lrc;
 use syntax::ast;
 use syntax::ext::base::{MacroExpanderFn, NormalTT, NamedSyntaxExtension};
+use syntax::ext::hygiene;
 use syntax::symbol::Symbol;
 
 pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver,
@@ -74,6 +75,7 @@ pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver,
                         allow_internal_unstable: false,
                         allow_internal_unsafe: false,
                         unstable_feature: None,
+                        edition: hygiene::default_edition(),
                     });
         )* }
     }
@@ -128,7 +130,8 @@ pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver,
                 def_info: None,
                 allow_internal_unstable: true,
                 allow_internal_unsafe: false,
-                unstable_feature: None
+                unstable_feature: None,
+                edition: hygiene::default_edition(),
             });
 
     for (name, ext) in user_exts {
diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs
index d684e8b4ffe..3593165023a 100644
--- a/src/libsyntax_ext/proc_macro_registrar.rs
+++ b/src/libsyntax_ext/proc_macro_registrar.rs
@@ -14,7 +14,7 @@ use errors;
 
 use syntax::ast::{self, Ident, NodeId};
 use syntax::attr;
-use syntax::codemap::{ExpnInfo, NameAndSpan, MacroAttribute, respan};
+use syntax::codemap::{ExpnInfo, NameAndSpan, MacroAttribute, hygiene, respan};
 use syntax::ext::base::ExtCtxt;
 use syntax::ext::build::AstBuilder;
 use syntax::ext::expand::ExpansionConfig;
@@ -369,6 +369,7 @@ fn mk_registrar(cx: &mut ExtCtxt,
             span: None,
             allow_internal_unstable: true,
             allow_internal_unsafe: false,
+            edition: hygiene::default_edition(),
         }
     });
     let span = DUMMY_SP.apply_mark(mark);