about summary refs log tree commit diff
path: root/src/test/ui/issues
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-11-14 14:47:14 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2021-02-07 20:08:45 +0300
commitdbdbd30bf2cb0d48c8bbce83c2458592664dbb18 (patch)
tree92877e16f45e3cf927ffc4296e0f90c48ec036f5 /src/test/ui/issues
parentae00b62ceb7eaf1f02f5289ab233bf7e0e8060d5 (diff)
expand/resolve: Turn `#[derive]` into a regular macro attribute
Diffstat (limited to 'src/test/ui/issues')
-rw-r--r--src/test/ui/issues/issue-49934-errors.rs9
-rw-r--r--src/test/ui/issues/issue-49934-errors.stderr13
-rw-r--r--src/test/ui/issues/issue-49934.rs17
-rw-r--r--src/test/ui/issues/issue-49934.stderr31
4 files changed, 27 insertions, 43 deletions
diff --git a/src/test/ui/issues/issue-49934-errors.rs b/src/test/ui/issues/issue-49934-errors.rs
index bf95f8fa7e1..dd14bac5e3a 100644
--- a/src/test/ui/issues/issue-49934-errors.rs
+++ b/src/test/ui/issues/issue-49934-errors.rs
@@ -1,11 +1,8 @@
-fn foo<#[derive(Debug)] T>() {
-//~^ ERROR `derive` may only be applied to structs, enums and unions
+fn foo<#[derive(Debug)] T>() { //~ ERROR expected non-macro attribute, found attribute macro
     match 0 {
-        #[derive(Debug)]
-        //~^ ERROR `derive` may only be applied to structs, enums and unions
+        #[derive(Debug)] //~ ERROR expected non-macro attribute, found attribute macro
         _ => (),
     }
 }
 
-fn main() {
-}
+fn main() {}
diff --git a/src/test/ui/issues/issue-49934-errors.stderr b/src/test/ui/issues/issue-49934-errors.stderr
index 71cd2d30342..8c4c54170a1 100644
--- a/src/test/ui/issues/issue-49934-errors.stderr
+++ b/src/test/ui/issues/issue-49934-errors.stderr
@@ -1,15 +1,14 @@
-error[E0774]: `derive` may only be applied to structs, enums and unions
-  --> $DIR/issue-49934-errors.rs:1:8
+error: expected non-macro attribute, found attribute macro `derive`
+  --> $DIR/issue-49934-errors.rs:1:10
    |
 LL | fn foo<#[derive(Debug)] T>() {
-   |        ^^^^^^^^^^^^^^^^
+   |          ^^^^^^ not a non-macro attribute
 
-error[E0774]: `derive` may only be applied to structs, enums and unions
-  --> $DIR/issue-49934-errors.rs:4:9
+error: expected non-macro attribute, found attribute macro `derive`
+  --> $DIR/issue-49934-errors.rs:3:11
    |
 LL |         #[derive(Debug)]
-   |         ^^^^^^^^^^^^^^^^
+   |           ^^^^^^ not a non-macro attribute
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0774`.
diff --git a/src/test/ui/issues/issue-49934.rs b/src/test/ui/issues/issue-49934.rs
index 5b253750db0..ec73e670634 100644
--- a/src/test/ui/issues/issue-49934.rs
+++ b/src/test/ui/issues/issue-49934.rs
@@ -1,7 +1,4 @@
-// check-pass
-
 #![feature(stmt_expr_attributes)]
-#![warn(unused_attributes)] //~ NOTE the lint level is defined here
 
 fn main() {
     // fold_stmt (Item)
@@ -10,26 +7,24 @@ fn main() {
     struct Foo;
 
     // fold_stmt (Mac)
-    #[derive(Debug)]
-    //~^ WARN `#[derive]` does nothing on macro invocations
-    //~| NOTE this may become a hard error in a future release
+    #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
     println!("Hello, world!");
 
     // fold_stmt (Semi)
-    #[derive(Debug)] //~ WARN unused attribute
+    #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
     "Hello, world!";
 
     // fold_stmt (Local)
-    #[derive(Debug)] //~ WARN unused attribute
+    #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
     let _ = "Hello, world!";
 
     // visit_expr
     let _ = #[derive(Debug)] "Hello, world!";
-    //~^ WARN unused attribute
+    //~^ ERROR `derive` may only be applied to structs, enums and unions
 
     let _ = [
         // filter_map_expr
-        #[derive(Debug)] //~ WARN unused attribute
-        "Hello, world!"
+        #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions
+        "Hello, world!",
     ];
 }
diff --git a/src/test/ui/issues/issue-49934.stderr b/src/test/ui/issues/issue-49934.stderr
index 8a5596521ec..7746ad287ab 100644
--- a/src/test/ui/issues/issue-49934.stderr
+++ b/src/test/ui/issues/issue-49934.stderr
@@ -1,40 +1,33 @@
-warning: `#[derive]` does nothing on macro invocations
-  --> $DIR/issue-49934.rs:13:5
+error[E0774]: `derive` may only be applied to structs, enums and unions
+  --> $DIR/issue-49934.rs:10:5
    |
 LL |     #[derive(Debug)]
    |     ^^^^^^^^^^^^^^^^
-   |
-   = note: this may become a hard error in a future release
 
-warning: unused attribute
-  --> $DIR/issue-49934.rs:19:5
+error[E0774]: `derive` may only be applied to structs, enums and unions
+  --> $DIR/issue-49934.rs:14:5
    |
 LL |     #[derive(Debug)]
    |     ^^^^^^^^^^^^^^^^
-   |
-note: the lint level is defined here
-  --> $DIR/issue-49934.rs:4:9
-   |
-LL | #![warn(unused_attributes)]
-   |         ^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-49934.rs:23:5
+error[E0774]: `derive` may only be applied to structs, enums and unions
+  --> $DIR/issue-49934.rs:18:5
    |
 LL |     #[derive(Debug)]
    |     ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-49934.rs:27:13
+error[E0774]: `derive` may only be applied to structs, enums and unions
+  --> $DIR/issue-49934.rs:22:13
    |
 LL |     let _ = #[derive(Debug)] "Hello, world!";
    |             ^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-49934.rs:32:9
+error[E0774]: `derive` may only be applied to structs, enums and unions
+  --> $DIR/issue-49934.rs:27:9
    |
 LL |         #[derive(Debug)]
    |         ^^^^^^^^^^^^^^^^
 
-warning: 5 warnings emitted
+error: aborting due to 5 previous errors
 
+For more information about this error, try `rustc --explain E0774`.