about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-09 00:20:35 +0200
committerGitHub <noreply@github.com>2019-06-09 00:20:35 +0200
commit21b5c1d51e9fcf26eca5a1ccc8dfaee5240f7522 (patch)
treeb6a64d9a639c695e131be663ff9ca613e1da8fdf /src/libsyntax
parent2410b4de7c425b1160a4368bc944d081d6e48a70 (diff)
parentee189ae028ce4ff620630686432f44b0ea706181 (diff)
downloadrust-21b5c1d51e9fcf26eca5a1ccc8dfaee5240f7522.tar.gz
rust-21b5c1d51e9fcf26eca5a1ccc8dfaee5240f7522.zip
Rollup merge of #61660 - petrochenkov:nocusta, r=Centril
Minimize use of `#![feature(custom_attribute)]`

Some preparations before resurrecting https://github.com/rust-lang/rust/pull/57921.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index b41b91c7631..7119fd13fbb 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -1331,6 +1331,16 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
                                                 "internal implementation detail",
                                                 cfg_fn!(rustc_attrs))),
 
+    (sym::rustc_allocator, Whitelisted, template!(Word), Gated(Stability::Unstable,
+                                                sym::rustc_attrs,
+                                                "internal implementation detail",
+                                                cfg_fn!(rustc_attrs))),
+
+    (sym::rustc_dummy, Normal, template!(Word /* doesn't matter*/), Gated(Stability::Unstable,
+                                         sym::rustc_attrs,
+                                         "used by the test suite",
+                                         cfg_fn!(rustc_attrs))),
+
     // FIXME: #14408 whitelist docs since rustdoc looks at them
     (
         sym::doc,
@@ -1957,12 +1967,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
         }
 
         match attr_info {
-            Some(&(name, _, template, _)) => self.check_builtin_attribute(
-                attr,
-                name,
-                template
-            ),
-            None => if let Some(TokenTree::Token(token)) = attr.tokens.trees().next() {
+            // `rustc_dummy` doesn't have any restrictions specific to built-in attributes.
+            Some(&(name, _, template, _)) if name != sym::rustc_dummy =>
+                self.check_builtin_attribute(attr, name, template),
+            _ => if let Some(TokenTree::Token(token)) = attr.tokens.trees().next() {
                 if token == token::Eq {
                     // All key-value attributes are restricted to meta-item syntax.
                     attr.parse_meta(self.context.parse_sess).map_err(|mut err| err.emit()).ok();