about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-07 00:48:00 +0000
committerbors <bors@rust-lang.org>2018-12-07 00:48:00 +0000
commita2fb99bc17527798aeeef1d7ccc61811a9362131 (patch)
tree1895bf679f871bc0466087f22b54fe1fabdcfb1f /src/test
parent5182cc1ca65d05f16ee5e1529707ac6f63233ca9 (diff)
parent8ab115c21d5309ecf486a517d52deaa56522c823 (diff)
downloadrust-a2fb99bc17527798aeeef1d7ccc61811a9362131.tar.gz
rust-a2fb99bc17527798aeeef1d7ccc61811a9362131.zip
Auto merge of #54271 - petrochenkov:nolegder, r=eddyb,alexcrichton
Unsupport `#[derive(Trait)]` sugar for `#[derive_Trait]` legacy plugin attributes

This is a long deprecated unstable feature that doesn't mesh well with regular resolution/expansion.

How to fix broken code:
- The recommended way is to migrate to stable procedural macros - derives or attributes (https://doc.rust-lang.org/nightly/book/first-edition/procedural-macros.html).
- If that's not possible right now for some reason, you can keep code working with a simple mechanical replacement `#[derive(Legacy)]` -> `#[derive_Legacy]`.

Closes https://github.com/rust-lang/rust/issues/29644

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/proc-macro/derive-still-gated.rs2
-rw-r--r--src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs4
-rw-r--r--src/test/run-pass-fulldeps/custom-derive-partial-eq.rs4
-rw-r--r--src/test/run-pass-fulldeps/custom-derive-partial-eq.stderr6
-rw-r--r--src/test/run-pass-fulldeps/derive-totalsum-attr.rs2
-rw-r--r--src/test/run-pass-fulldeps/derive-totalsum.rs6
-rw-r--r--src/test/run-pass-fulldeps/issue-40663.rs6
-rw-r--r--src/test/ui/feature-gates/feature-gate-custom_derive.rs15
-rw-r--r--src/test/ui/feature-gates/feature-gate-custom_derive.stderr11
-rw-r--r--src/test/ui/issues/issue-32655.rs4
-rw-r--r--src/test/ui/issues/issue-32655.stderr12
11 files changed, 21 insertions, 51 deletions
diff --git a/src/test/compile-fail/proc-macro/derive-still-gated.rs b/src/test/compile-fail/proc-macro/derive-still-gated.rs
index f36236c5356..edf5cc7e9ae 100644
--- a/src/test/compile-fail/proc-macro/derive-still-gated.rs
+++ b/src/test/compile-fail/proc-macro/derive-still-gated.rs
@@ -15,7 +15,7 @@
 #[macro_use]
 extern crate derive_a;
 
-#[derive_A] //~ ERROR: attributes of the form `#[derive_*]` are reserved for the compiler
+#[derive_A] //~ ERROR attribute `derive_A` is currently unknown
 struct A;
 
 fn main() {}
diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs
index 449cd29ada3..b8f91386f08 100644
--- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs
@@ -31,11 +31,11 @@ use rustc_plugin::Registry;
 
 #[plugin_registrar]
 pub fn plugin_registrar(reg: &mut Registry) {
-    reg.register_custom_derive(
+    reg.register_syntax_extension(
         Symbol::intern("derive_TotalSum"),
         MultiDecorator(box expand));
 
-    reg.register_custom_derive(
+    reg.register_syntax_extension(
         Symbol::intern("derive_Nothing"),
         MultiDecorator(box noop));
 }
diff --git a/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs b/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs
index 47f5f8397d1..f986efb913c 100644
--- a/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs
+++ b/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs
@@ -10,11 +10,11 @@
 
 // aux-build:custom_derive_partial_eq.rs
 // ignore-stage1
-#![feature(plugin, custom_derive)]
+#![feature(plugin)]
 #![plugin(custom_derive_partial_eq)]
 #![allow(unused)]
 
-#[derive(CustomPartialEq)] // Check that this is not a stability error.
+#[derive_CustomPartialEq] // Check that this is not a stability error.
 enum E { V1, V2 }
 
 fn main() {}
diff --git a/src/test/run-pass-fulldeps/custom-derive-partial-eq.stderr b/src/test/run-pass-fulldeps/custom-derive-partial-eq.stderr
deleted file mode 100644
index ba956e4c132..00000000000
--- a/src/test/run-pass-fulldeps/custom-derive-partial-eq.stderr
+++ /dev/null
@@ -1,6 +0,0 @@
-warning: `#[derive]` for custom traits is deprecated and will be removed in the future. Prefer using procedural macro custom derive.
-  --> $DIR/custom-derive-partial-eq.rs:17:10
-   |
-LL | #[derive(CustomPartialEq)] // Check that this is not a stability error.
-   |          ^^^^^^^^^^^^^^^
-
diff --git a/src/test/run-pass-fulldeps/derive-totalsum-attr.rs b/src/test/run-pass-fulldeps/derive-totalsum-attr.rs
index e088f5e4262..374e15d22a1 100644
--- a/src/test/run-pass-fulldeps/derive-totalsum-attr.rs
+++ b/src/test/run-pass-fulldeps/derive-totalsum-attr.rs
@@ -11,7 +11,7 @@
 // aux-build:custom_derive_plugin_attr.rs
 // ignore-stage1
 
-#![feature(plugin, custom_derive, rustc_attrs)]
+#![feature(plugin, rustc_attrs)]
 #![plugin(custom_derive_plugin_attr)]
 
 trait TotalSum {
diff --git a/src/test/run-pass-fulldeps/derive-totalsum.rs b/src/test/run-pass-fulldeps/derive-totalsum.rs
index 848b2425e44..86f14ca4463 100644
--- a/src/test/run-pass-fulldeps/derive-totalsum.rs
+++ b/src/test/run-pass-fulldeps/derive-totalsum.rs
@@ -11,7 +11,7 @@
 // aux-build:custom_derive_plugin.rs
 // ignore-stage1
 
-#![feature(plugin, custom_derive)]
+#![feature(plugin)]
 #![plugin(custom_derive_plugin)]
 
 trait TotalSum {
@@ -32,14 +32,14 @@ impl TotalSum for Seven {
     }
 }
 
-#[derive(TotalSum)]
+#[derive_TotalSum]
 struct Foo {
     seven: Seven,
     bar: Bar,
     baz: isize,
 }
 
-#[derive(TotalSum)]
+#[derive_TotalSum]
 struct Bar {
     quux: isize,
     bleh: isize,
diff --git a/src/test/run-pass-fulldeps/issue-40663.rs b/src/test/run-pass-fulldeps/issue-40663.rs
index 8633e906082..a33e9cc0543 100644
--- a/src/test/run-pass-fulldeps/issue-40663.rs
+++ b/src/test/run-pass-fulldeps/issue-40663.rs
@@ -12,10 +12,12 @@
 // aux-build:custom_derive_plugin.rs
 // ignore-stage1
 
-#![feature(plugin, custom_derive)]
+#![feature(plugin)]
 #![plugin(custom_derive_plugin)]
 
-#[derive(Nothing, Nothing, Nothing)]
+#[derive_Nothing]
+#[derive_Nothing]
+#[derive_Nothing]
 struct S;
 
 fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-custom_derive.rs b/src/test/ui/feature-gates/feature-gate-custom_derive.rs
deleted file mode 100644
index 0b1b3141f5b..00000000000
--- a/src/test/ui/feature-gates/feature-gate-custom_derive.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive_Clone]
-//~^ ERROR attributes of the form `#[derive_*]` are reserved
-struct Test;
-
-pub fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-custom_derive.stderr b/src/test/ui/feature-gates/feature-gate-custom_derive.stderr
deleted file mode 100644
index 0979372daea..00000000000
--- a/src/test/ui/feature-gates/feature-gate-custom_derive.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
-  --> $DIR/feature-gate-custom_derive.rs:11:3
-   |
-LL | #[derive_Clone]
-   |   ^^^^^^^^^^^^
-   |
-   = help: add #![feature(custom_derive)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issues/issue-32655.rs b/src/test/ui/issues/issue-32655.rs
index 25ecd5d0862..bbe95a4371e 100644
--- a/src/test/ui/issues/issue-32655.rs
+++ b/src/test/ui/issues/issue-32655.rs
@@ -13,7 +13,7 @@
 
 macro_rules! foo (
     () => (
-        #[derive_Clone] //~ ERROR attributes of the form
+        #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown
         struct T;
     );
 );
@@ -25,7 +25,7 @@ macro_rules! bar (
 foo!();
 
 bar!(
-    #[derive_Clone] //~ ERROR attributes of the form
+    #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown
     struct S;
 );
 
diff --git a/src/test/ui/issues/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr
index f930217fe9e..88da51a478a 100644
--- a/src/test/ui/issues/issue-32655.stderr
+++ b/src/test/ui/issues/issue-32655.stderr
@@ -1,21 +1,21 @@
-error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
+error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
   --> $DIR/issue-32655.rs:16:11
    |
-LL |         #[derive_Clone] //~ ERROR attributes of the form
+LL |         #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown
    |           ^^^^^^^^^^^^
 ...
 LL | foo!();
    | ------- in this macro invocation
    |
-   = help: add #![feature(custom_derive)] to the crate attributes to enable
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644)
+error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
   --> $DIR/issue-32655.rs:28:7
    |
-LL |     #[derive_Clone] //~ ERROR attributes of the form
+LL |     #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown
    |       ^^^^^^^^^^^^
    |
-   = help: add #![feature(custom_derive)] to the crate attributes to enable
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
 error: aborting due to 2 previous errors