about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-10-03 23:29:48 +0000
committerbors <bors@rust-lang.org>2019-10-03 23:29:48 +0000
commit31d75c4e9c5318e880601d3c2cc71e5df094a120 (patch)
tree715665644e650d0e3b22ced38a144b586a3616bf /src/libsyntax
parent032a53a06ce293571e51bbe621a5c480e8a28e95 (diff)
parentcc5dcfaada556c5b28f7e95a26d42119bd5e98cc (diff)
downloadrust-31d75c4e9c5318e880601d3c2cc71e5df094a120.tar.gz
rust-31d75c4e9c5318e880601d3c2cc71e5df094a120.zip
Auto merge of #65076 - tmandry:rollup-ka7nzb6, r=tmandry
Rollup of 11 pull requests

Successful merges:

 - #61879 (Stabilize todo macro)
 - #64675 (Deprecate `#![plugin]` & `#[plugin_registrar]`)
 - #64690 (proc_macro API: Expose `macro_rules` hygiene)
 - #64706 (add regression test for #60218)
 - #64741 (Prevent rustdoc feature doctests)
 - #64842 (Disallow Self in type param defaults of ADTs)
 - #65004 (Replace mentions of IRC with Discord)
 - #65018 (Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr)
 - #65055 (Add long error explanation for E0556)
 - #65056 (Make visit projection iterative)
 - #65057 (typo: fix typo in E0392)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/error_codes.rs20
-rw-r--r--src/libsyntax/ext/base.rs6
-rw-r--r--src/libsyntax/ext/proc_macro_server.rs5
-rw-r--r--src/libsyntax/feature_gate/builtin_attrs.rs21
4 files changed, 47 insertions, 5 deletions
diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs
index 8a78daee6e4..c0963026945 100644
--- a/src/libsyntax/error_codes.rs
+++ b/src/libsyntax/error_codes.rs
@@ -208,6 +208,25 @@ If you need the feature, make sure to use a nightly release of the compiler
 (but be warned that the feature may be removed or altered in the future).
 "##,
 
+E0556: r##"
+The `feature` attribute was badly formed.
+
+Erroneous code example:
+
+```compile_fail,E0556
+#![feature(foo_bar_baz, foo(bar), foo = "baz", foo)] // error!
+#![feature] // error!
+#![feature = "foo"] // error!
+```
+
+The `feature` attribute only accept a "feature flag" and can only be used on
+nightly. Example:
+
+```ignore (only works in nightly)
+#![feature(flag)]
+```
+"##,
+
 E0557: r##"
 A feature attribute named a feature that has been removed.
 
@@ -457,7 +476,6 @@ features in the `-Z allow_features` flag.
     E0551, // incorrect meta item
     E0553, // multiple rustc_const_unstable attributes
 //  E0555, // replaced with a generic attribute input check
-    E0556, // malformed feature, expected just one word
     E0584, // file for module `..` found at both .. and ..
     E0629, // missing 'feature' (rustc_const_unstable)
     // rustc_const_unstable attribute must be paired with stable/unstable
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 54cfb80573e..583fb3f7701 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -953,6 +953,12 @@ impl<'a> ExtCtxt<'a> {
         span.with_call_site_ctxt(self.current_expansion.id)
     }
 
+    /// Equivalent of `Span::mixed_site` from the proc macro API,
+    /// except that the location is taken from the span passed as an argument.
+    pub fn with_mixed_site_ctxt(&self, span: Span) -> Span {
+        span.with_mixed_site_ctxt(self.current_expansion.id)
+    }
+
     /// Returns span for the macro which originally caused the current expansion to happen.
     ///
     /// Stops backtracing at include! boundary.
diff --git a/src/libsyntax/ext/proc_macro_server.rs b/src/libsyntax/ext/proc_macro_server.rs
index dfec9ee2880..021ec46d987 100644
--- a/src/libsyntax/ext/proc_macro_server.rs
+++ b/src/libsyntax/ext/proc_macro_server.rs
@@ -355,6 +355,7 @@ pub(crate) struct Rustc<'a> {
     sess: &'a ParseSess,
     def_site: Span,
     call_site: Span,
+    mixed_site: Span,
 }
 
 impl<'a> Rustc<'a> {
@@ -364,6 +365,7 @@ impl<'a> Rustc<'a> {
             sess: cx.parse_sess,
             def_site: cx.with_def_site_ctxt(expn_data.def_site),
             call_site: cx.with_call_site_ctxt(expn_data.call_site),
+            mixed_site: cx.with_mixed_site_ctxt(expn_data.call_site),
         }
     }
 
@@ -664,6 +666,9 @@ impl server::Span for Rustc<'_> {
     fn call_site(&mut self) -> Self::Span {
         self.call_site
     }
+    fn mixed_site(&mut self) -> Self::Span {
+        self.mixed_site
+    }
     fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
         self.sess.source_map().lookup_char_pos(span.lo()).file
     }
diff --git a/src/libsyntax/feature_gate/builtin_attrs.rs b/src/libsyntax/feature_gate/builtin_attrs.rs
index d14afc6deaa..80a80ff0a0d 100644
--- a/src/libsyntax/feature_gate/builtin_attrs.rs
+++ b/src/libsyntax/feature_gate/builtin_attrs.rs
@@ -278,10 +278,23 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
     ),
 
     // Plugins:
-    ungated!(plugin_registrar, Normal, template!(Word)),
-    gated!(
-        plugin, CrateLevel, template!(List: "name|name(args)"),
-        "compiler plugins are experimental and possibly buggy",
+    (
+        sym::plugin_registrar, Normal, template!(Word),
+        Gated(
+            Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None),
+            sym::plugin_registrar,
+            "compiler plugins are deprecated",
+            cfg_fn!(plugin_registrar)
+        )
+    ),
+    (
+        sym::plugin, CrateLevel, template!(List: "name|name(args)"),
+        Gated(
+            Stability::Deprecated("https://github.com/rust-lang/rust/issues/29597", None),
+            sym::plugin,
+            "compiler plugins are deprecated",
+            cfg_fn!(plugin)
+        )
     ),
 
     // Testing: