about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-05-22 01:09:58 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-05-22 02:20:34 +0300
commitfb52aeafc97f4927e7dcc178a81bc005c3dc0015 (patch)
tree6176b8ea09306d7bf4291f3b0ebcef8a89c2f0b6
parent50a0defd5a93523067ef239936cc2e0755220904 (diff)
downloadrust-fb52aeafc97f4927e7dcc178a81bc005c3dc0015.tar.gz
rust-fb52aeafc97f4927e7dcc178a81bc005c3dc0015.zip
tests: Centralize proc macros commonly used for testing
-rw-r--r--src/test/ui/custom-derive/auxiliary/plugin.rs28
-rw-r--r--src/test/ui/custom-derive/derive-in-mod.rs13
-rw-r--r--src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs12
-rw-r--r--src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr21
-rw-r--r--src/test/ui/custom-derive/helper-attr-blocked-by-import.rs28
-rw-r--r--src/test/ui/custom-derive/issue-36935.rs12
-rw-r--r--src/test/ui/custom-derive/issue-36935.stderr10
-rw-r--r--src/test/ui/proc-macro/attribute-order-restricted.rs10
-rw-r--r--src/test/ui/proc-macro/attribute-order-restricted.stderr4
-rw-r--r--src/test/ui/proc-macro/attribute-with-error.rs17
-rw-r--r--src/test/ui/proc-macro/attribute-with-error.stderr8
-rw-r--r--src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/attribute-with-error.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-a-b.rs17
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-a.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs2
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs12
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs17
-rw-r--r--src/test/ui/proc-macro/auxiliary/derive-panic.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs6
-rw-r--r--src/test/ui/proc-macro/auxiliary/dollar-crate.rs35
-rw-r--r--src/test/ui/proc-macro/auxiliary/issue-41211.rs12
-rw-r--r--src/test/ui/proc-macro/auxiliary/issue-53481.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/macro-brackets.rs12
-rw-r--r--src/test/ui/proc-macro/auxiliary/nested-item-spans.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs18
-rw-r--r--src/test/ui/proc-macro/auxiliary/span-preservation.rs13
-rw-r--r--src/test/ui/proc-macro/auxiliary/test-macros.rs104
-rw-r--r--src/test/ui/proc-macro/derive-helper-shadowed.rs12
-rw-r--r--src/test/ui/proc-macro/derive-helper-shadowing.rs20
-rw-r--r--src/test/ui/proc-macro/derive-helper-shadowing.stderr34
-rw-r--r--src/test/ui/proc-macro/derive-in-mod.rs13
-rw-r--r--src/test/ui/proc-macro/derive-still-gated.rs8
-rw-r--r--src/test/ui/proc-macro/derive-still-gated.stderr8
-rw-r--r--src/test/ui/proc-macro/dollar-crate-issue-57089.rs9
-rw-r--r--src/test/ui/proc-macro/dollar-crate-issue-57089.stdout9
-rw-r--r--src/test/ui/proc-macro/dollar-crate.rs13
-rw-r--r--src/test/ui/proc-macro/dollar-crate.stderr4
-rw-r--r--src/test/ui/proc-macro/dollar-crate.stdout28
-rw-r--r--src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.rs11
-rw-r--r--src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr21
-rw-r--r--src/test/ui/proc-macro/helper-attr-blocked-by-import.rs28
-rw-r--r--src/test/ui/proc-macro/import.rs11
-rw-r--r--src/test/ui/proc-macro/import.stderr8
-rw-r--r--src/test/ui/proc-macro/issue-36935.rs12
-rw-r--r--src/test/ui/proc-macro/issue-36935.stderr10
-rw-r--r--src/test/ui/proc-macro/issue-37788.rs4
-rw-r--r--src/test/ui/proc-macro/issue-41211.rs10
-rw-r--r--src/test/ui/proc-macro/issue-41211.stderr10
-rw-r--r--src/test/ui/proc-macro/issue-53481.rs14
-rw-r--r--src/test/ui/proc-macro/load-panic.rs7
-rw-r--r--src/test/ui/proc-macro/load-panic.stderr8
-rw-r--r--src/test/ui/proc-macro/macro-brackets.rs8
-rw-r--r--src/test/ui/proc-macro/macro-use-attr.rs7
-rw-r--r--src/test/ui/proc-macro/macro-use-bang.rs6
-rw-r--r--src/test/ui/proc-macro/macros-in-extern.rs9
-rw-r--r--src/test/ui/proc-macro/macros-in-extern.stderr18
-rw-r--r--src/test/ui/proc-macro/nested-item-spans.rs11
-rw-r--r--src/test/ui/proc-macro/nested-item-spans.stderr4
-rw-r--r--src/test/ui/proc-macro/no-macro-use-attr.rs4
-rw-r--r--src/test/ui/proc-macro/no-macro-use-attr.stderr4
-rw-r--r--src/test/ui/proc-macro/proc-macro-gates.rs43
-rw-r--r--src/test/ui/proc-macro/proc-macro-gates.stderr98
-rw-r--r--src/test/ui/proc-macro/proc-macro-gates2.rs11
-rw-r--r--src/test/ui/proc-macro/proc-macro-gates2.stderr16
-rw-r--r--src/test/ui/proc-macro/resolve-error.rs10
-rw-r--r--src/test/ui/proc-macro/resolve-error.stderr16
-rw-r--r--src/test/ui/proc-macro/shadow.rs6
-rw-r--r--src/test/ui/proc-macro/shadow.stderr12
-rw-r--r--src/test/ui/proc-macro/span-preservation.rs17
-rw-r--r--src/test/ui/proc-macro/span-preservation.stderr10
72 files changed, 475 insertions, 649 deletions
diff --git a/src/test/ui/custom-derive/auxiliary/plugin.rs b/src/test/ui/custom-derive/auxiliary/plugin.rs
deleted file mode 100644
index 5e500de607c..00000000000
--- a/src/test/ui/custom-derive/auxiliary/plugin.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(Foo)]
-pub fn derive_foo(input: TokenStream) -> TokenStream {
-    input
-}
-
-#[proc_macro_derive(Bar)]
-pub fn derive_bar(input: TokenStream) -> TokenStream {
-    panic!("lolnope");
-}
-
-#[proc_macro_derive(WithHelper, attributes(helper))]
-pub fn with_helper(input: TokenStream) -> TokenStream {
-    TokenStream::new()
-}
-
-#[proc_macro_attribute]
-pub fn helper(_: TokenStream, input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/ui/custom-derive/derive-in-mod.rs b/src/test/ui/custom-derive/derive-in-mod.rs
deleted file mode 100644
index 8478ff1a6ae..00000000000
--- a/src/test/ui/custom-derive/derive-in-mod.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// compile-pass
-// aux-build:plugin.rs
-
-extern crate plugin;
-
-mod inner {
-    use plugin::WithHelper;
-
-    #[derive(WithHelper)]
-    struct S;
-}
-
-fn main() {}
diff --git a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs
deleted file mode 100644
index ba072ba3568..00000000000
--- a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// aux-build:plugin.rs
-
-#[macro_use(WithHelper)]
-extern crate plugin;
-
-use plugin::helper;
-
-#[derive(WithHelper)]
-#[helper] //~ ERROR `helper` is ambiguous
-struct S;
-
-fn main() {}
diff --git a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr
deleted file mode 100644
index e83c291c9bf..00000000000
--- a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0659]: `helper` is ambiguous (derive helper attribute vs any other name)
-  --> $DIR/helper-attr-blocked-by-import-ambig.rs:9:3
-   |
-LL | #[helper]
-   |   ^^^^^^ ambiguous name
-   |
-note: `helper` could refer to the derive helper attribute defined here
-  --> $DIR/helper-attr-blocked-by-import-ambig.rs:8:10
-   |
-LL | #[derive(WithHelper)]
-   |          ^^^^^^^^^^
-note: `helper` could also refer to the attribute macro imported here
-  --> $DIR/helper-attr-blocked-by-import-ambig.rs:6:5
-   |
-LL | use plugin::helper;
-   |     ^^^^^^^^^^^^^^
-   = help: use `crate::helper` to refer to this attribute macro unambiguously
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/custom-derive/helper-attr-blocked-by-import.rs b/src/test/ui/custom-derive/helper-attr-blocked-by-import.rs
deleted file mode 100644
index abbf014f553..00000000000
--- a/src/test/ui/custom-derive/helper-attr-blocked-by-import.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// compile-pass
-// aux-build:plugin.rs
-
-#[macro_use(WithHelper)]
-extern crate plugin;
-
-use self::one::*;
-use self::two::*;
-
-mod helper {}
-
-mod one {
-    use helper;
-
-    #[derive(WithHelper)]
-    #[helper]
-    struct One;
-}
-
-mod two {
-    use helper;
-
-    #[derive(WithHelper)]
-    #[helper]
-    struct Two;
-}
-
-fn main() {}
diff --git a/src/test/ui/custom-derive/issue-36935.rs b/src/test/ui/custom-derive/issue-36935.rs
deleted file mode 100644
index 7a5d19f771f..00000000000
--- a/src/test/ui/custom-derive/issue-36935.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// aux-build:plugin.rs
-
-
-#[macro_use] extern crate plugin;
-
-#[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked
-struct Baz {
-    a: i32,
-    b: i32,
-}
-
-fn main() {}
diff --git a/src/test/ui/custom-derive/issue-36935.stderr b/src/test/ui/custom-derive/issue-36935.stderr
deleted file mode 100644
index 2875bc5fce9..00000000000
--- a/src/test/ui/custom-derive/issue-36935.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error: proc-macro derive panicked
-  --> $DIR/issue-36935.rs:6:15
-   |
-LL | #[derive(Foo, Bar)]
-   |               ^^^
-   |
-   = help: message: lolnope
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/proc-macro/attribute-order-restricted.rs b/src/test/ui/proc-macro/attribute-order-restricted.rs
index 7b1eecd1558..a3d4d23450c 100644
--- a/src/test/ui/proc-macro/attribute-order-restricted.rs
+++ b/src/test/ui/proc-macro/attribute-order-restricted.rs
@@ -1,14 +1,14 @@
-// aux-build:attr_proc_macro.rs
+// aux-build:test-macros.rs
 
-extern crate attr_proc_macro;
-use attr_proc_macro::*;
+#[macro_use]
+extern crate test_macros;
 
-#[attr_proc_macro] // OK
+#[identity_attr] // OK
 #[derive(Clone)]
 struct Before;
 
 #[derive(Clone)]
-#[attr_proc_macro] //~ ERROR macro attributes must be placed before `#[derive]`
+#[identity_attr] //~ ERROR macro attributes must be placed before `#[derive]`
 struct After;
 
 fn main() {}
diff --git a/src/test/ui/proc-macro/attribute-order-restricted.stderr b/src/test/ui/proc-macro/attribute-order-restricted.stderr
index 39db45cf569..9ca8a443e40 100644
--- a/src/test/ui/proc-macro/attribute-order-restricted.stderr
+++ b/src/test/ui/proc-macro/attribute-order-restricted.stderr
@@ -1,8 +1,8 @@
 error: macro attributes must be placed before `#[derive]`
   --> $DIR/attribute-order-restricted.rs:11:1
    |
-LL | #[attr_proc_macro]
-   | ^^^^^^^^^^^^^^^^^^
+LL | #[identity_attr]
+   | ^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/attribute-with-error.rs b/src/test/ui/proc-macro/attribute-with-error.rs
index 2cced40830a..aaa6c07dddb 100644
--- a/src/test/ui/proc-macro/attribute-with-error.rs
+++ b/src/test/ui/proc-macro/attribute-with-error.rs
@@ -1,12 +1,11 @@
-// aux-build:attribute-with-error.rs
+// aux-build:test-macros.rs
 
 #![feature(custom_inner_attributes)]
 
-extern crate attribute_with_error;
+#[macro_use]
+extern crate test_macros;
 
-use attribute_with_error::foo;
-
-#[foo]
+#[recollect_attr]
 fn test1() {
     let a: i32 = "foo";
     //~^ ERROR: mismatched types
@@ -15,13 +14,13 @@ fn test1() {
 }
 
 fn test2() {
-    #![foo]
+    #![recollect_attr]
 
     // FIXME: should have a type error here and assert it works but it doesn't
 }
 
 trait A {
-    // FIXME: should have a #[foo] attribute here and assert that it works
+    // FIXME: should have a #[recollect_attr] attribute here and assert that it works
     fn foo(&self) {
         let a: i32 = "foo";
         //~^ ERROR: mismatched types
@@ -31,13 +30,13 @@ trait A {
 struct B;
 
 impl A for B {
-    #[foo]
+    #[recollect_attr]
     fn foo(&self) {
         let a: i32 = "foo";
         //~^ ERROR: mismatched types
     }
 }
 
-#[foo]
+#[recollect_attr]
 fn main() {
 }
diff --git a/src/test/ui/proc-macro/attribute-with-error.stderr b/src/test/ui/proc-macro/attribute-with-error.stderr
index c5970ab6baa..937d47ff089 100644
--- a/src/test/ui/proc-macro/attribute-with-error.stderr
+++ b/src/test/ui/proc-macro/attribute-with-error.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/attribute-with-error.rs:11:18
+  --> $DIR/attribute-with-error.rs:10:18
    |
 LL |     let a: i32 = "foo";
    |                  ^^^^^ expected i32, found reference
@@ -8,7 +8,7 @@ LL |     let a: i32 = "foo";
               found type `&'static str`
 
 error[E0308]: mismatched types
-  --> $DIR/attribute-with-error.rs:13:18
+  --> $DIR/attribute-with-error.rs:12:18
    |
 LL |     let b: i32 = "f'oo";
    |                  ^^^^^^ expected i32, found reference
@@ -17,7 +17,7 @@ LL |     let b: i32 = "f'oo";
               found type `&'static str`
 
 error[E0308]: mismatched types
-  --> $DIR/attribute-with-error.rs:26:22
+  --> $DIR/attribute-with-error.rs:25:22
    |
 LL |         let a: i32 = "foo";
    |                      ^^^^^ expected i32, found reference
@@ -26,7 +26,7 @@ LL |         let a: i32 = "foo";
               found type `&'static str`
 
 error[E0308]: mismatched types
-  --> $DIR/attribute-with-error.rs:36:22
+  --> $DIR/attribute-with-error.rs:35:22
    |
 LL |         let a: i32 = "foo";
    |                      ^^^^^ expected i32, found reference
diff --git a/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs b/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs
deleted file mode 100644
index b1f54be6bac..00000000000
--- a/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs b/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs
deleted file mode 100644
index c073be00310..00000000000
--- a/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn foo(_attr: TokenStream, input: TokenStream) -> TokenStream {
-    input.into_iter().collect()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs b/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs
deleted file mode 100644
index 16f3b764029..00000000000
--- a/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro]
-pub fn bang_proc_macro(input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-a-b.rs b/src/test/ui/proc-macro/auxiliary/derive-a-b.rs
deleted file mode 100644
index 64d4e0f7b7a..00000000000
--- a/src/test/ui/proc-macro/auxiliary/derive-a-b.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(A)]
-pub fn derive_a(_: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
-
-#[proc_macro_derive(B)]
-pub fn derive_b(_: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-a.rs b/src/test/ui/proc-macro/auxiliary/derive-a.rs
deleted file mode 100644
index c9d94aba9f7..00000000000
--- a/src/test/ui/proc-macro/auxiliary/derive-a.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(A)]
-pub fn derive_a(input: TokenStream) -> TokenStream {
-    "".parse().unwrap()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs
index 9912a89dafb..ab532da2992 100644
--- a/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs
+++ b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs
@@ -1,2 +1,2 @@
 #[macro_export]
-macro_rules! my_attr { () => () }
+macro_rules! empty_helper { () => () }
diff --git a/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs
deleted file mode 100644
index 5b5243dd60e..00000000000
--- a/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::*;
-
-#[proc_macro_derive(MyTrait, attributes(my_attr))]
-pub fn foo(_: TokenStream) -> TokenStream {
-    TokenStream::new()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs
deleted file mode 100644
index 6e0bdcba9c5..00000000000
--- a/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::*;
-
-#[proc_macro_attribute]
-pub fn my_attr(_: TokenStream, input: TokenStream) -> TokenStream {
-    input
-}
-
-#[proc_macro_derive(MyTrait, attributes(my_attr))]
-pub fn derive(input: TokenStream) -> TokenStream {
-    TokenStream::new()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/derive-panic.rs b/src/test/ui/proc-macro/auxiliary/derive-panic.rs
deleted file mode 100644
index e2afa7affa3..00000000000
--- a/src/test/ui/proc-macro/auxiliary/derive-panic.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_derive(A)]
-pub fn derive_a(_input: TokenStream) -> TokenStream {
-    panic!("nope!");
-}
diff --git a/src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs b/src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs
index 8f15a2b975b..d5d393b5a64 100644
--- a/src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs
+++ b/src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs
@@ -3,14 +3,14 @@ pub type S = u8;
 #[macro_export]
 macro_rules! external {
     () => {
-        dollar_crate::m! {
+        print_bang! {
             struct M($crate::S);
         }
 
-        #[dollar_crate::a]
+        #[print_attr]
         struct A($crate::S);
 
-        #[derive(dollar_crate::d)]
+        #[derive(Print)]
         struct D($crate::S);
     };
 }
diff --git a/src/test/ui/proc-macro/auxiliary/dollar-crate.rs b/src/test/ui/proc-macro/auxiliary/dollar-crate.rs
deleted file mode 100644
index c5347d2e81a..00000000000
--- a/src/test/ui/proc-macro/auxiliary/dollar-crate.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::TokenStream;
-
-#[proc_macro]
-pub fn m_empty(input: TokenStream) -> TokenStream {
-    println!("PROC MACRO INPUT (PRETTY-PRINTED): {}", input);
-    println!("PROC MACRO INPUT: {:#?}", input);
-    TokenStream::new()
-}
-
-#[proc_macro]
-pub fn m(input: TokenStream) -> TokenStream {
-    println!("PROC MACRO INPUT (PRETTY-PRINTED): {}", input);
-    println!("PROC MACRO INPUT: {:#?}", input);
-    input.into_iter().collect()
-}
-
-#[proc_macro_attribute]
-pub fn a(_args: TokenStream, input: TokenStream) -> TokenStream {
-    println!("ATTRIBUTE INPUT (PRETTY-PRINTED): {}", input);
-    println!("ATTRIBUTE INPUT: {:#?}", input);
-    input.into_iter().collect()
-}
-
-#[proc_macro_derive(d)]
-pub fn d(input: TokenStream) -> TokenStream {
-    println!("DERIVE INPUT (PRETTY-PRINTED): {}", input);
-    println!("DERIVE INPUT: {:#?}", input);
-    input.into_iter().collect()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/issue-41211.rs b/src/test/ui/proc-macro/auxiliary/issue-41211.rs
deleted file mode 100644
index db946e7f331..00000000000
--- a/src/test/ui/proc-macro/auxiliary/issue-41211.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn emit_unchanged(_args: TokenStream, input: TokenStream) -> TokenStream {
-    input
-}
diff --git a/src/test/ui/proc-macro/auxiliary/issue-53481.rs b/src/test/ui/proc-macro/auxiliary/issue-53481.rs
deleted file mode 100644
index d9f290dec7e..00000000000
--- a/src/test/ui/proc-macro/auxiliary/issue-53481.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::*;
-
-#[proc_macro_derive(MyTrait, attributes(my_attr))]
-pub fn foo(_: TokenStream) -> TokenStream {
-    TokenStream::new()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/macro-brackets.rs b/src/test/ui/proc-macro/auxiliary/macro-brackets.rs
deleted file mode 100644
index f2c62ab1b5e..00000000000
--- a/src/test/ui/proc-macro/auxiliary/macro-brackets.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-use proc_macro::*;
-
-#[proc_macro_attribute]
-pub fn doit(_: TokenStream, input: TokenStream) -> TokenStream {
-    input.into_iter().collect()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs b/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs
deleted file mode 100644
index 8f720b4574d..00000000000
--- a/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::*;
-
-#[proc_macro_attribute]
-pub fn foo(_: TokenStream, item: TokenStream) -> TokenStream {
-    item.into_iter().collect()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs
deleted file mode 100644
index c7c7167eca0..00000000000
--- a/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::*;
-
-#[proc_macro]
-pub fn m(a: TokenStream) -> TokenStream {
-    a
-}
-
-#[proc_macro_attribute]
-pub fn a(_a: TokenStream, b: TokenStream) -> TokenStream {
-    b
-}
diff --git a/src/test/ui/proc-macro/auxiliary/span-preservation.rs b/src/test/ui/proc-macro/auxiliary/span-preservation.rs
deleted file mode 100644
index 33c7968104b..00000000000
--- a/src/test/ui/proc-macro/auxiliary/span-preservation.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// force-host
-// no-prefer-dynamic
-
-#![crate_type = "proc-macro"]
-
-extern crate proc_macro;
-
-use proc_macro::TokenStream;
-
-#[proc_macro_attribute]
-pub fn foo(_: TokenStream, input: TokenStream) -> TokenStream {
-    input.into_iter().collect()
-}
diff --git a/src/test/ui/proc-macro/auxiliary/test-macros.rs b/src/test/ui/proc-macro/auxiliary/test-macros.rs
index 15fe3804f9b..27efa44f980 100644
--- a/src/test/ui/proc-macro/auxiliary/test-macros.rs
+++ b/src/test/ui/proc-macro/auxiliary/test-macros.rs
@@ -1,26 +1,112 @@
 // force-host
 // no-prefer-dynamic
 
+// Proc macros commonly used by tests.
+// `panic`/`print` -> `panic_bang`/`print_bang` to avoid conflicts with standard macros.
+
 #![crate_type = "proc-macro"]
 
 extern crate proc_macro;
-
 use proc_macro::TokenStream;
 
+// Macro that return empty token stream.
+
+#[proc_macro]
+pub fn empty(_: TokenStream) -> TokenStream {
+    TokenStream::new()
+}
+
 #[proc_macro_attribute]
-pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream {
-    assert!(_attr.to_string().is_empty());
-    input
+pub fn empty_attr(_: TokenStream, _: TokenStream) -> TokenStream {
+    TokenStream::new()
+}
+
+#[proc_macro_derive(Empty, attributes(empty_helper))]
+pub fn empty_derive(_: TokenStream) -> TokenStream {
+    TokenStream::new()
+}
+
+// Macro that panics.
+
+#[proc_macro]
+pub fn panic_bang(_: TokenStream) -> TokenStream {
+    panic!("panic-bang");
 }
 
 #[proc_macro_attribute]
-pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream {
-    assert!(_attr.to_string().is_empty());
-    assert!(!_input.to_string().is_empty());
-    "".parse().unwrap()
+pub fn panic_attr(_: TokenStream, _: TokenStream) -> TokenStream {
+    panic!("panic-attr");
+}
+
+#[proc_macro_derive(Panic, attributes(panic_helper))]
+pub fn panic_derive(_: TokenStream) -> TokenStream {
+    panic!("panic-derive");
 }
 
+// Macros that return the input stream.
+
 #[proc_macro]
-pub fn emit_input(input: TokenStream) -> TokenStream {
+pub fn identity(input: TokenStream) -> TokenStream {
     input
 }
+
+#[proc_macro_attribute]
+pub fn identity_attr(_: TokenStream, input: TokenStream) -> TokenStream {
+    input
+}
+
+#[proc_macro_derive(Identity, attributes(identity_helper))]
+pub fn identity_derive(input: TokenStream) -> TokenStream {
+    input
+}
+
+// Macros that iterate and re-collect the input stream.
+
+#[proc_macro]
+pub fn recollect(input: TokenStream) -> TokenStream {
+    input.into_iter().collect()
+}
+
+#[proc_macro_attribute]
+pub fn recollect_attr(_: TokenStream, input: TokenStream) -> TokenStream {
+    input.into_iter().collect()
+}
+
+#[proc_macro_derive(Recollect, attributes(recollect_helper))]
+pub fn recollect_derive(input: TokenStream) -> TokenStream {
+    input.into_iter().collect()
+}
+
+// Macros that print their input in the original and re-collected forms (if they differ).
+
+fn print_helper(input: TokenStream, kind: &str) -> TokenStream {
+    let input_display = format!("{}", input);
+    let input_debug = format!("{:#?}", input);
+    let recollected = input.into_iter().collect();
+    let recollected_display = format!("{}", recollected);
+    let recollected_debug = format!("{:#?}", recollected);
+    println!("PRINT-{} INPUT (DISPLAY): {}", kind, input_display);
+    if recollected_display != input_display {
+        println!("PRINT-{} RE-COLLECTED (DISPLAY): {}", kind, recollected_display);
+    }
+    println!("PRINT-{} INPUT (DEBUG): {}", kind, input_debug);
+    if recollected_debug != input_debug {
+        println!("PRINT-{} RE-COLLECTED (DEBUG): {}", kind, recollected_debug);
+    }
+    recollected
+}
+
+#[proc_macro]
+pub fn print_bang(input: TokenStream) -> TokenStream {
+    print_helper(input, "BANG")
+}
+
+#[proc_macro_attribute]
+pub fn print_attr(_: TokenStream, input: TokenStream) -> TokenStream {
+    print_helper(input, "ATTR")
+}
+
+#[proc_macro_derive(Print, attributes(print_helper))]
+pub fn print_derive(input: TokenStream) -> TokenStream {
+    print_helper(input, "DERIVE")
+}
diff --git a/src/test/ui/proc-macro/derive-helper-shadowed.rs b/src/test/ui/proc-macro/derive-helper-shadowed.rs
index 792b54b3b94..0388e647b58 100644
--- a/src/test/ui/proc-macro/derive-helper-shadowed.rs
+++ b/src/test/ui/proc-macro/derive-helper-shadowed.rs
@@ -1,16 +1,16 @@
 // compile-pass
-// aux-build:derive-helper-shadowed.rs
+// aux-build:test-macros.rs
 // aux-build:derive-helper-shadowed-2.rs
 
 #[macro_use]
-extern crate derive_helper_shadowed;
-#[macro_use(my_attr)]
+extern crate test_macros;
+#[macro_use(empty_helper)]
 extern crate derive_helper_shadowed_2;
 
-macro_rules! my_attr { () => () }
+macro_rules! empty_helper { () => () }
 
-#[derive(MyTrait)]
-#[my_attr] // OK
+#[derive(Empty)]
+#[empty_helper] // OK
 struct S;
 
 fn main() {}
diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.rs b/src/test/ui/proc-macro/derive-helper-shadowing.rs
index f6fe9f9fd8b..cdc0d6da946 100644
--- a/src/test/ui/proc-macro/derive-helper-shadowing.rs
+++ b/src/test/ui/proc-macro/derive-helper-shadowing.rs
@@ -1,23 +1,25 @@
-// aux-build:derive-helper-shadowing.rs
+// aux-build:test-macros.rs
 
-extern crate derive_helper_shadowing;
-use derive_helper_shadowing::*;
+#[macro_use]
+extern crate test_macros;
 
-#[my_attr] //~ ERROR `my_attr` is ambiguous
-#[derive(MyTrait)]
+use test_macros::empty_attr as empty_helper;
+
+#[empty_helper] //~ ERROR `empty_helper` is ambiguous
+#[derive(Empty)]
 struct S {
     // FIXME No ambiguity, attributes in non-macro positions are not resolved properly
-    #[my_attr]
+    #[empty_helper]
     field: [u8; {
         // FIXME No ambiguity, derive helpers are not put into scope for non-attributes
-        use my_attr;
+        use empty_helper;
 
         // FIXME No ambiguity, derive helpers are not put into scope for inner items
-        #[my_attr]
+        #[empty_helper]
         struct U;
 
         mod inner {
-            #[my_attr] //~ ERROR attribute `my_attr` is currently unknown
+            #[empty_helper] //~ ERROR attribute `empty_helper` is currently unknown
             struct V;
         }
 
diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr
index fb86cabf939..ed6d3051656 100644
--- a/src/test/ui/proc-macro/derive-helper-shadowing.stderr
+++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr
@@ -1,29 +1,29 @@
-error[E0658]: The attribute `my_attr` is currently unknown to the compiler and may have meaning added to it in the future
-  --> $DIR/derive-helper-shadowing.rs:20:15
+error[E0658]: The attribute `empty_helper` is currently unknown to the compiler and may have meaning added to it in the future
+  --> $DIR/derive-helper-shadowing.rs:22:15
    |
-LL |             #[my_attr]
-   |               ^^^^^^^
+LL |             #[empty_helper]
+   |               ^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error[E0659]: `my_attr` is ambiguous (derive helper attribute vs any other name)
-  --> $DIR/derive-helper-shadowing.rs:6:3
+error[E0659]: `empty_helper` is ambiguous (derive helper attribute vs any other name)
+  --> $DIR/derive-helper-shadowing.rs:8:3
    |
-LL | #[my_attr]
-   |   ^^^^^^^ ambiguous name
+LL | #[empty_helper]
+   |   ^^^^^^^^^^^^ ambiguous name
    |
-note: `my_attr` could refer to the derive helper attribute defined here
-  --> $DIR/derive-helper-shadowing.rs:7:10
+note: `empty_helper` could refer to the derive helper attribute defined here
+  --> $DIR/derive-helper-shadowing.rs:9:10
    |
-LL | #[derive(MyTrait)]
-   |          ^^^^^^^
-note: `my_attr` could also refer to the attribute macro imported here
-  --> $DIR/derive-helper-shadowing.rs:4:5
+LL | #[derive(Empty)]
+   |          ^^^^^
+note: `empty_helper` could also refer to the attribute macro imported here
+  --> $DIR/derive-helper-shadowing.rs:6:5
    |
-LL | use derive_helper_shadowing::*;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = help: use `crate::my_attr` to refer to this attribute macro unambiguously
+LL | use test_macros::empty_attr as empty_helper;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: use `crate::empty_helper` to refer to this attribute macro unambiguously
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/proc-macro/derive-in-mod.rs b/src/test/ui/proc-macro/derive-in-mod.rs
new file mode 100644
index 00000000000..e6b91324f95
--- /dev/null
+++ b/src/test/ui/proc-macro/derive-in-mod.rs
@@ -0,0 +1,13 @@
+// compile-pass
+// aux-build:test-macros.rs
+
+extern crate test_macros;
+
+mod inner {
+    use test_macros::Empty;
+
+    #[derive(Empty)]
+    struct S;
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/derive-still-gated.rs b/src/test/ui/proc-macro/derive-still-gated.rs
index 526eff39891..d895d26f267 100644
--- a/src/test/ui/proc-macro/derive-still-gated.rs
+++ b/src/test/ui/proc-macro/derive-still-gated.rs
@@ -1,11 +1,9 @@
-// aux-build:derive-a.rs
-
-#![allow(warnings)]
+// aux-build:test-macros.rs
 
 #[macro_use]
-extern crate derive_a;
+extern crate test_macros;
 
-#[derive_A] //~ ERROR attribute `derive_A` is currently unknown
+#[derive_Empty] //~ ERROR attribute `derive_Empty` is currently unknown
 struct A;
 
 fn main() {}
diff --git a/src/test/ui/proc-macro/derive-still-gated.stderr b/src/test/ui/proc-macro/derive-still-gated.stderr
index d235343ff16..f299b5abdbc 100644
--- a/src/test/ui/proc-macro/derive-still-gated.stderr
+++ b/src/test/ui/proc-macro/derive-still-gated.stderr
@@ -1,8 +1,8 @@
-error[E0658]: The attribute `derive_A` is currently unknown to the compiler and may have meaning added to it in the future
-  --> $DIR/derive-still-gated.rs:8:3
+error[E0658]: The attribute `derive_Empty` is currently unknown to the compiler and may have meaning added to it in the future
+  --> $DIR/derive-still-gated.rs:6:3
    |
-LL | #[derive_A]
-   |   ^^^^^^^^ help: a built-in attribute with a similar name exists: `derive`
+LL | #[derive_Empty]
+   |   ^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
diff --git a/src/test/ui/proc-macro/dollar-crate-issue-57089.rs b/src/test/ui/proc-macro/dollar-crate-issue-57089.rs
index 2d54c07ff95..2615db3e119 100644
--- a/src/test/ui/proc-macro/dollar-crate-issue-57089.rs
+++ b/src/test/ui/proc-macro/dollar-crate-issue-57089.rs
@@ -1,22 +1,23 @@
 // compile-pass
 // edition:2018
-// aux-build:dollar-crate.rs
+// aux-build:test-macros.rs
 
 // Anonymize unstable non-dummy spans while still showing dummy spans `0..0`.
 // normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)"
 // normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)"
 
-extern crate dollar_crate;
+#[macro_use]
+extern crate test_macros;
 
 type S = u8;
 
 macro_rules! m {
     () => {
-        dollar_crate::m_empty! {
+        print_bang! {
             struct M($crate::S);
         }
 
-        #[dollar_crate::a]
+        #[print_attr]
         struct A($crate::S);
     };
 }
diff --git a/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout b/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout
index 618380d7f0b..0611fcb13f2 100644
--- a/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout
+++ b/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout
@@ -1,5 +1,5 @@
-PROC MACRO INPUT (PRETTY-PRINTED): struct M ( $crate :: S ) ;
-PROC MACRO INPUT: TokenStream [
+PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
+PRINT-BANG INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #2 bytes(LO..HI),
@@ -38,8 +38,9 @@ PROC MACRO INPUT: TokenStream [
         span: #2 bytes(LO..HI),
     },
 ]
-ATTRIBUTE INPUT (PRETTY-PRINTED): struct A(crate::S);
-ATTRIBUTE INPUT: TokenStream [
+PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
+PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #2 bytes(LO..HI),
diff --git a/src/test/ui/proc-macro/dollar-crate.rs b/src/test/ui/proc-macro/dollar-crate.rs
index 1460e9a3b2d..aadd87ffaf2 100644
--- a/src/test/ui/proc-macro/dollar-crate.rs
+++ b/src/test/ui/proc-macro/dollar-crate.rs
@@ -1,29 +1,28 @@
 // edition:2018
-// aux-build:dollar-crate.rs
+// aux-build:test-macros.rs
 // aux-build:dollar-crate-external.rs
 
 // Anonymize unstable non-dummy spans while still showing dummy spans `0..0`.
 // normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)"
 // normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)"
 
-extern crate dollar_crate;
+#[macro_use]
+extern crate test_macros;
 extern crate dollar_crate_external;
 
 type S = u8;
 
 mod local {
-    use crate::dollar_crate;
-
     macro_rules! local {
         () => {
-            dollar_crate::m! {
+            print_bang! {
                 struct M($crate::S);
             }
 
-            #[dollar_crate::a]
+            #[print_attr]
             struct A($crate::S);
 
-            #[derive(dollar_crate::d)]
+            #[derive(Print)]
             struct D($crate::S); //~ ERROR the name `D` is defined multiple times
         };
     }
diff --git a/src/test/ui/proc-macro/dollar-crate.stderr b/src/test/ui/proc-macro/dollar-crate.stderr
index d1b836e7f6f..5d78a8e1987 100644
--- a/src/test/ui/proc-macro/dollar-crate.stderr
+++ b/src/test/ui/proc-macro/dollar-crate.stderr
@@ -1,5 +1,5 @@
 error[E0428]: the name `D` is defined multiple times
-  --> $DIR/dollar-crate.rs:27:13
+  --> $DIR/dollar-crate.rs:26:13
    |
 LL |             struct D($crate::S);
    |             ^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL |     local!();
    = note: `D` must be defined only once in the type namespace of this module
 
 error[E0428]: the name `D` is defined multiple times
-  --> $DIR/dollar-crate.rs:37:5
+  --> $DIR/dollar-crate.rs:36:5
    |
 LL |     dollar_crate_external::external!();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/proc-macro/dollar-crate.stdout b/src/test/ui/proc-macro/dollar-crate.stdout
index 454da539430..3c88ee99842 100644
--- a/src/test/ui/proc-macro/dollar-crate.stdout
+++ b/src/test/ui/proc-macro/dollar-crate.stdout
@@ -1,5 +1,5 @@
-PROC MACRO INPUT (PRETTY-PRINTED): struct M ( $crate :: S ) ;
-PROC MACRO INPUT: TokenStream [
+PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
+PRINT-BANG INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #2 bytes(LO..HI),
@@ -38,8 +38,9 @@ PROC MACRO INPUT: TokenStream [
         span: #2 bytes(LO..HI),
     },
 ]
-ATTRIBUTE INPUT (PRETTY-PRINTED): struct A(crate::S);
-ATTRIBUTE INPUT: TokenStream [
+PRINT-ATTR INPUT (DISPLAY): struct A(crate::S);
+PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #2 bytes(LO..HI),
@@ -78,8 +79,9 @@ ATTRIBUTE INPUT: TokenStream [
         span: #2 bytes(LO..HI),
     },
 ]
-DERIVE INPUT (PRETTY-PRINTED): struct D(crate::S);
-DERIVE INPUT: TokenStream [
+PRINT-DERIVE INPUT (DISPLAY): struct D(crate::S);
+PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( $crate :: S ) ;
+PRINT-DERIVE INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #2 bytes(LO..HI),
@@ -118,8 +120,8 @@ DERIVE INPUT: TokenStream [
         span: #2 bytes(LO..HI),
     },
 ]
-PROC MACRO INPUT (PRETTY-PRINTED): struct M ( $crate :: S ) ;
-PROC MACRO INPUT: TokenStream [
+PRINT-BANG INPUT (DISPLAY): struct M ( $crate :: S ) ;
+PRINT-BANG INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #10 bytes(LO..HI),
@@ -158,8 +160,9 @@ PROC MACRO INPUT: TokenStream [
         span: #10 bytes(LO..HI),
     },
 ]
-ATTRIBUTE INPUT (PRETTY-PRINTED): struct A(::dollar_crate_external::S);
-ATTRIBUTE INPUT: TokenStream [
+PRINT-ATTR INPUT (DISPLAY): struct A(::dollar_crate_external::S);
+PRINT-ATTR RE-COLLECTED (DISPLAY): struct A ( $crate :: S ) ;
+PRINT-ATTR INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #10 bytes(LO..HI),
@@ -198,8 +201,9 @@ ATTRIBUTE INPUT: TokenStream [
         span: #10 bytes(LO..HI),
     },
 ]
-DERIVE INPUT (PRETTY-PRINTED): struct D(::dollar_crate_external::S);
-DERIVE INPUT: TokenStream [
+PRINT-DERIVE INPUT (DISPLAY): struct D(::dollar_crate_external::S);
+PRINT-DERIVE RE-COLLECTED (DISPLAY): struct D ( $crate :: S ) ;
+PRINT-DERIVE INPUT (DEBUG): TokenStream [
     Ident {
         ident: "struct",
         span: #10 bytes(LO..HI),
diff --git a/src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.rs b/src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.rs
new file mode 100644
index 00000000000..3a1c56efce8
--- /dev/null
+++ b/src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.rs
@@ -0,0 +1,11 @@
+// aux-build:test-macros.rs
+
+#[macro_use(Empty)]
+extern crate test_macros;
+use test_macros::empty_attr as empty_helper;
+
+#[derive(Empty)]
+#[empty_helper] //~ ERROR `empty_helper` is ambiguous
+struct S;
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr
new file mode 100644
index 00000000000..012fb105b12
--- /dev/null
+++ b/src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr
@@ -0,0 +1,21 @@
+error[E0659]: `empty_helper` is ambiguous (derive helper attribute vs any other name)
+  --> $DIR/helper-attr-blocked-by-import-ambig.rs:8:3
+   |
+LL | #[empty_helper]
+   |   ^^^^^^^^^^^^ ambiguous name
+   |
+note: `empty_helper` could refer to the derive helper attribute defined here
+  --> $DIR/helper-attr-blocked-by-import-ambig.rs:7:10
+   |
+LL | #[derive(Empty)]
+   |          ^^^^^
+note: `empty_helper` could also refer to the attribute macro imported here
+  --> $DIR/helper-attr-blocked-by-import-ambig.rs:5:5
+   |
+LL | use test_macros::empty_attr as empty_helper;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = help: use `crate::empty_helper` to refer to this attribute macro unambiguously
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/proc-macro/helper-attr-blocked-by-import.rs b/src/test/ui/proc-macro/helper-attr-blocked-by-import.rs
new file mode 100644
index 00000000000..6d3e5ec198d
--- /dev/null
+++ b/src/test/ui/proc-macro/helper-attr-blocked-by-import.rs
@@ -0,0 +1,28 @@
+// compile-pass
+// aux-build:test-macros.rs
+
+#[macro_use(Empty)]
+extern crate test_macros;
+
+use self::one::*;
+use self::two::*;
+
+mod empty_helper {}
+
+mod one {
+    use empty_helper;
+
+    #[derive(Empty)]
+    #[empty_helper]
+    struct One;
+}
+
+mod two {
+    use empty_helper;
+
+    #[derive(Empty)]
+    #[empty_helper]
+    struct Two;
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/import.rs b/src/test/ui/proc-macro/import.rs
index 8fbccdf1aed..d1b1ff35069 100644
--- a/src/test/ui/proc-macro/import.rs
+++ b/src/test/ui/proc-macro/import.rs
@@ -1,11 +1,8 @@
-// aux-build:derive-a.rs
+// aux-build:test-macros.rs
 
-#![allow(warnings)]
+extern crate test_macros;
 
-#[macro_use]
-extern crate derive_a;
-
-use derive_a::derive_a;
-//~^ ERROR: unresolved import `derive_a::derive_a`
+use test_macros::empty_derive;
+//~^ ERROR: unresolved import `test_macros::empty_derive`
 
 fn main() {}
diff --git a/src/test/ui/proc-macro/import.stderr b/src/test/ui/proc-macro/import.stderr
index 813a8ac2604..aae621193ab 100644
--- a/src/test/ui/proc-macro/import.stderr
+++ b/src/test/ui/proc-macro/import.stderr
@@ -1,8 +1,8 @@
-error[E0432]: unresolved import `derive_a::derive_a`
-  --> $DIR/import.rs:8:5
+error[E0432]: unresolved import `test_macros::empty_derive`
+  --> $DIR/import.rs:5:5
    |
-LL | use derive_a::derive_a;
-   |     ^^^^^^^^^^^^^^^^^^ no `derive_a` in the root
+LL | use test_macros::empty_derive;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^ no `empty_derive` in the root
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/issue-36935.rs b/src/test/ui/proc-macro/issue-36935.rs
new file mode 100644
index 00000000000..f809592d5f4
--- /dev/null
+++ b/src/test/ui/proc-macro/issue-36935.rs
@@ -0,0 +1,12 @@
+// aux-build:test-macros.rs
+
+#[macro_use]
+extern crate test_macros;
+
+#[derive(Identity, Panic)] //~ ERROR proc-macro derive panicked
+struct Baz {
+    a: i32,
+    b: i32,
+}
+
+fn main() {}
diff --git a/src/test/ui/proc-macro/issue-36935.stderr b/src/test/ui/proc-macro/issue-36935.stderr
new file mode 100644
index 00000000000..da4366eb668
--- /dev/null
+++ b/src/test/ui/proc-macro/issue-36935.stderr
@@ -0,0 +1,10 @@
+error: proc-macro derive panicked
+  --> $DIR/issue-36935.rs:6:20
+   |
+LL | #[derive(Identity, Panic)]
+   |                    ^^^^^
+   |
+   = help: message: panic-derive
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/proc-macro/issue-37788.rs b/src/test/ui/proc-macro/issue-37788.rs
index 75fcd24d85f..73b1f0d58c8 100644
--- a/src/test/ui/proc-macro/issue-37788.rs
+++ b/src/test/ui/proc-macro/issue-37788.rs
@@ -1,7 +1,7 @@
-// aux-build:derive-a-b.rs
+// aux-build:test-macros.rs
 
 #[macro_use]
-extern crate derive_a_b;
+extern crate test_macros;
 
 fn main() {
     // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE.
diff --git a/src/test/ui/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs
index 0b082f4818f..ee9246e1c9b 100644
--- a/src/test/ui/proc-macro/issue-41211.rs
+++ b/src/test/ui/proc-macro/issue-41211.rs
@@ -1,14 +1,14 @@
-// aux-build:issue-41211.rs
+// aux-build:test-macros.rs
 
 // FIXME: https://github.com/rust-lang/rust/issues/41430
 // This is a temporary regression test for the ICE reported in #41211
 
 #![feature(custom_inner_attributes)]
 
-#![emit_unchanged]
-//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler
+#![identity_attr]
+//~^ ERROR attribute `identity_attr` is currently unknown to the compiler
 //~| ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro
-extern crate issue_41211;
-use issue_41211::emit_unchanged;
+extern crate test_macros;
+use test_macros::identity_attr;
 
 fn main() {}
diff --git a/src/test/ui/proc-macro/issue-41211.stderr b/src/test/ui/proc-macro/issue-41211.stderr
index dfb2f6f63d8..1de6b293ecf 100644
--- a/src/test/ui/proc-macro/issue-41211.stderr
+++ b/src/test/ui/proc-macro/issue-41211.stderr
@@ -1,8 +1,8 @@
-error[E0658]: The attribute `emit_unchanged` is currently unknown to the compiler and may have meaning added to it in the future
+error[E0658]: The attribute `identity_attr` is currently unknown to the compiler and may have meaning added to it in the future
   --> $DIR/issue-41211.rs:8:4
    |
-LL | #![emit_unchanged]
-   |    ^^^^^^^^^^^^^^
+LL | #![identity_attr]
+   |    ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
@@ -10,8 +10,8 @@ LL | #![emit_unchanged]
 error: inconsistent resolution for a macro: first custom attribute, then attribute macro
   --> $DIR/issue-41211.rs:8:4
    |
-LL | #![emit_unchanged]
-   |    ^^^^^^^^^^^^^^
+LL | #![identity_attr]
+   |    ^^^^^^^^^^^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/proc-macro/issue-53481.rs b/src/test/ui/proc-macro/issue-53481.rs
index 479fd1db630..2fbde5fedb9 100644
--- a/src/test/ui/proc-macro/issue-53481.rs
+++ b/src/test/ui/proc-macro/issue-53481.rs
@@ -1,21 +1,21 @@
 // compile-pass
-// aux-build:issue-53481.rs
+// aux-build:test-macros.rs
 
 #[macro_use]
-extern crate issue_53481;
+extern crate test_macros;
 
 mod m1 {
-    use m2::MyTrait;
+    use m2::Empty;
 
-    #[derive(MyTrait)]
+    #[derive(Empty)]
     struct A {}
 }
 
 mod m2 {
-    pub type MyTrait = u8;
+    pub type Empty = u8;
 
-    #[derive(MyTrait)]
-    #[my_attr]
+    #[derive(Empty)]
+    #[empty_helper]
     struct B {}
 }
 
diff --git a/src/test/ui/proc-macro/load-panic.rs b/src/test/ui/proc-macro/load-panic.rs
index fa279c559fb..2e9a311d882 100644
--- a/src/test/ui/proc-macro/load-panic.rs
+++ b/src/test/ui/proc-macro/load-panic.rs
@@ -1,10 +1,9 @@
-// aux-build:derive-panic.rs
-// compile-flags:--error-format human
+// aux-build:test-macros.rs
 
 #[macro_use]
-extern crate derive_panic;
+extern crate test_macros;
 
-#[derive(A)]
+#[derive(Panic)]
 //~^ ERROR: proc-macro derive panicked
 struct Foo;
 
diff --git a/src/test/ui/proc-macro/load-panic.stderr b/src/test/ui/proc-macro/load-panic.stderr
index b448c804bff..40cc4ee0e3d 100644
--- a/src/test/ui/proc-macro/load-panic.stderr
+++ b/src/test/ui/proc-macro/load-panic.stderr
@@ -1,10 +1,10 @@
 error: proc-macro derive panicked
-  --> $DIR/load-panic.rs:7:10
+  --> $DIR/load-panic.rs:6:10
    |
-LL | #[derive(A)]
-   |          ^
+LL | #[derive(Panic)]
+   |          ^^^^^
    |
-   = help: message: nope!
+   = help: message: panic-derive
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/macro-brackets.rs b/src/test/ui/proc-macro/macro-brackets.rs
index c46abf03654..aa0046f4582 100644
--- a/src/test/ui/proc-macro/macro-brackets.rs
+++ b/src/test/ui/proc-macro/macro-brackets.rs
@@ -1,13 +1,13 @@
-// aux-build:macro-brackets.rs
+// aux-build:test-macros.rs
 
-extern crate macro_brackets as bar;
-use bar::doit;
+#[macro_use]
+extern crate test_macros;
 
 macro_rules! id {
     ($($t:tt)*) => ($($t)*)
 }
 
-#[doit]
+#[identity_attr]
 id![static X: u32 = 'a';]; //~ ERROR: mismatched types
 
 
diff --git a/src/test/ui/proc-macro/macro-use-attr.rs b/src/test/ui/proc-macro/macro-use-attr.rs
index 13db0725a38..d1b1430fb5d 100644
--- a/src/test/ui/proc-macro/macro-use-attr.rs
+++ b/src/test/ui/proc-macro/macro-use-attr.rs
@@ -1,9 +1,10 @@
 // compile-pass
-// aux-build:attr_proc_macro.rs
+// aux-build:test-macros.rs
 
-#[macro_use] extern crate attr_proc_macro;
+#[macro_use]
+extern crate test_macros;
 
-#[attr_proc_macro]
+#[identity_attr]
 struct Foo;
 
 fn main() {
diff --git a/src/test/ui/proc-macro/macro-use-bang.rs b/src/test/ui/proc-macro/macro-use-bang.rs
index 4bf3bcd6f3a..d39c42267fb 100644
--- a/src/test/ui/proc-macro/macro-use-bang.rs
+++ b/src/test/ui/proc-macro/macro-use-bang.rs
@@ -1,11 +1,11 @@
 // compile-pass
-// aux-build:bang_proc_macro.rs
+// aux-build:test-macros.rs
 
 #![feature(proc_macro_hygiene)]
 
 #[macro_use]
-extern crate bang_proc_macro;
+extern crate test_macros;
 
 fn main() {
-    bang_proc_macro!(println!("Hello, world!"));
+    identity!(println!("Hello, world!"));
 }
diff --git a/src/test/ui/proc-macro/macros-in-extern.rs b/src/test/ui/proc-macro/macros-in-extern.rs
index 5c5603b6c06..0477b5c48ec 100644
--- a/src/test/ui/proc-macro/macros-in-extern.rs
+++ b/src/test/ui/proc-macro/macros-in-extern.rs
@@ -1,10 +1,9 @@
 // aux-build:test-macros.rs
 // ignore-wasm32
 
+#[macro_use]
 extern crate test_macros;
 
-use test_macros::{nop_attr, no_output, emit_input};
-
 fn main() {
     assert_eq!(unsafe { rust_get_test_int() }, 0isize);
     assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEF);
@@ -12,14 +11,14 @@ fn main() {
 
 #[link(name = "rust_test_helpers", kind = "static")]
 extern {
-    #[no_output]
+    #[empty_attr]
     //~^ ERROR macro invocations in `extern {}` blocks are experimental
     fn some_definitely_unknown_symbol_which_should_be_removed();
 
-    #[nop_attr]
+    #[identity_attr]
     //~^ ERROR macro invocations in `extern {}` blocks are experimental
     fn rust_get_test_int() -> isize;
 
-    emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
+    identity!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
     //~^ ERROR macro invocations in `extern {}` blocks are experimental
 }
diff --git a/src/test/ui/proc-macro/macros-in-extern.stderr b/src/test/ui/proc-macro/macros-in-extern.stderr
index 61571650f2f..592c91553aa 100644
--- a/src/test/ui/proc-macro/macros-in-extern.stderr
+++ b/src/test/ui/proc-macro/macros-in-extern.stderr
@@ -1,26 +1,26 @@
 error[E0658]: macro invocations in `extern {}` blocks are experimental
-  --> $DIR/macros-in-extern.rs:15:5
+  --> $DIR/macros-in-extern.rs:14:5
    |
-LL |     #[no_output]
-   |     ^^^^^^^^^^^^
+LL |     #[empty_attr]
+   |     ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49476
    = help: add #![feature(macros_in_extern)] to the crate attributes to enable
 
 error[E0658]: macro invocations in `extern {}` blocks are experimental
-  --> $DIR/macros-in-extern.rs:19:5
+  --> $DIR/macros-in-extern.rs:18:5
    |
-LL |     #[nop_attr]
-   |     ^^^^^^^^^^^
+LL |     #[identity_attr]
+   |     ^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49476
    = help: add #![feature(macros_in_extern)] to the crate attributes to enable
 
 error[E0658]: macro invocations in `extern {}` blocks are experimental
-  --> $DIR/macros-in-extern.rs:23:5
+  --> $DIR/macros-in-extern.rs:22:5
    |
-LL |     emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     identity!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/49476
    = help: add #![feature(macros_in_extern)] to the crate attributes to enable
diff --git a/src/test/ui/proc-macro/nested-item-spans.rs b/src/test/ui/proc-macro/nested-item-spans.rs
index e365b74b3be..63da170d0bb 100644
--- a/src/test/ui/proc-macro/nested-item-spans.rs
+++ b/src/test/ui/proc-macro/nested-item-spans.rs
@@ -1,10 +1,9 @@
-// aux-build:nested-item-spans.rs
+// aux-build:test-macros.rs
 
-extern crate nested_item_spans;
+#[macro_use]
+extern crate test_macros;
 
-use nested_item_spans::foo;
-
-#[foo]
+#[recollect_attr]
 fn another() {
     fn bar() {
         let x: u32 = "x"; //~ ERROR: mismatched types
@@ -14,7 +13,7 @@ fn another() {
 }
 
 fn main() {
-    #[foo]
+    #[recollect_attr]
     fn bar() {
         let x: u32 = "x"; //~ ERROR: mismatched types
     }
diff --git a/src/test/ui/proc-macro/nested-item-spans.stderr b/src/test/ui/proc-macro/nested-item-spans.stderr
index 011a91d4462..bef80311f38 100644
--- a/src/test/ui/proc-macro/nested-item-spans.stderr
+++ b/src/test/ui/proc-macro/nested-item-spans.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/nested-item-spans.rs:10:22
+  --> $DIR/nested-item-spans.rs:9:22
    |
 LL |         let x: u32 = "x";
    |                      ^^^ expected u32, found reference
@@ -8,7 +8,7 @@ LL |         let x: u32 = "x";
               found type `&'static str`
 
 error[E0308]: mismatched types
-  --> $DIR/nested-item-spans.rs:19:22
+  --> $DIR/nested-item-spans.rs:18:22
    |
 LL |         let x: u32 = "x";
    |                      ^^^ expected u32, found reference
diff --git a/src/test/ui/proc-macro/no-macro-use-attr.rs b/src/test/ui/proc-macro/no-macro-use-attr.rs
index 62a501ded10..15ab431fe75 100644
--- a/src/test/ui/proc-macro/no-macro-use-attr.rs
+++ b/src/test/ui/proc-macro/no-macro-use-attr.rs
@@ -1,9 +1,9 @@
-// aux-build:derive-a.rs
+// aux-build:test-macros.rs
 
 #![feature(rustc_attrs)]
 #![warn(unused_extern_crates)]
 
-extern crate derive_a;
+extern crate test_macros;
 //~^ WARN unused extern crate
 
 #[rustc_error]
diff --git a/src/test/ui/proc-macro/no-macro-use-attr.stderr b/src/test/ui/proc-macro/no-macro-use-attr.stderr
index 4b2fce7f6e4..87487bcc7d6 100644
--- a/src/test/ui/proc-macro/no-macro-use-attr.stderr
+++ b/src/test/ui/proc-macro/no-macro-use-attr.stderr
@@ -1,8 +1,8 @@
 warning: unused extern crate
   --> $DIR/no-macro-use-attr.rs:6:1
    |
-LL | extern crate derive_a;
-   | ^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+LL | extern crate test_macros;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
    |
 note: lint level defined here
   --> $DIR/no-macro-use-attr.rs:4:9
diff --git a/src/test/ui/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs
index af6bfa08aaa..678dc83b753 100644
--- a/src/test/ui/proc-macro/proc-macro-gates.rs
+++ b/src/test/ui/proc-macro/proc-macro-gates.rs
@@ -1,61 +1,62 @@
-// aux-build:proc-macro-gates.rs
+// aux-build:test-macros.rs
 // gate-test-proc_macro_hygiene
 
 #![feature(stmt_expr_attributes)]
 
-extern crate proc_macro_gates as foo;
-
-use foo::*;
+#[macro_use]
+extern crate test_macros;
 
 fn _test_inner() {
-    #![a] //~ ERROR: non-builtin inner attributes are unstable
+    #![empty_attr] //~ ERROR: non-builtin inner attributes are unstable
 }
 
-#[a] //~ ERROR: custom attributes cannot be applied to modules
+#[empty_attr] //~ ERROR: custom attributes cannot be applied to modules
 mod _test2 {}
 
 mod _test2_inner {
-    #![a] //~ ERROR: custom attributes cannot be applied to modules
+    #![empty_attr] //~ ERROR: custom attributes cannot be applied to modules
           //~| ERROR: non-builtin inner attributes are unstable
 }
 
-#[a = "y"] //~ ERROR: must only be followed by a delimiter token
+#[empty_attr = "y"] //~ ERROR: must only be followed by a delimiter token
 fn _test3() {}
 
 fn attrs() {
     // Statement, item
-    #[a] // OK
+    #[empty_attr] // OK
     struct S;
 
     // Statement, macro
-    #[a] //~ ERROR: custom attributes cannot be applied to statements
+    #[empty_attr] //~ ERROR: custom attributes cannot be applied to statements
     println!();
 
     // Statement, semi
-    #[a] //~ ERROR: custom attributes cannot be applied to statements
+    #[empty_attr] //~ ERROR: custom attributes cannot be applied to statements
     S;
 
     // Statement, local
-    #[a] //~ ERROR: custom attributes cannot be applied to statements
+    #[empty_attr] //~ ERROR: custom attributes cannot be applied to statements
     let _x = 2;
 
     // Expr
-    let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions
+    let _x = #[identity_attr] 2; //~ ERROR: custom attributes cannot be applied to expressions
 
     // Opt expr
-    let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions
+    let _x = [#[identity_attr] 2]; //~ ERROR: custom attributes cannot be applied to expressions
 
     // Expr macro
-    let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions
+    let _x = #[identity_attr] println!();
+    //~^ ERROR: custom attributes cannot be applied to expressions
 }
 
 fn main() {
-    let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types
-    if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns
+    let _x: identity!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types
+    if let identity!(Some(_x)) = Some(3) {}
+    //~^ ERROR: procedural macros cannot be expanded to patterns
 
-    m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements
-    m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements
+    empty!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements
+    empty!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements
 
-    let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions
-    let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions
+    let _x = identity!(3); //~ ERROR: procedural macros cannot be expanded to expressions
+    let _x = [empty!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions
 }
diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr
index 1bb864b52ea..f53ad222a03 100644
--- a/src/test/ui/proc-macro/proc-macro-gates.stderr
+++ b/src/test/ui/proc-macro/proc-macro-gates.stderr
@@ -1,95 +1,95 @@
 error[E0658]: non-builtin inner attributes are unstable
-  --> $DIR/proc-macro-gates.rs:11:5
+  --> $DIR/proc-macro-gates.rs:10:5
    |
-LL |     #![a]
-   |     ^^^^^
+LL |     #![empty_attr]
+   |     ^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54726
    = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable
 
 error[E0658]: non-builtin inner attributes are unstable
-  --> $DIR/proc-macro-gates.rs:18:5
+  --> $DIR/proc-macro-gates.rs:17:5
    |
-LL |     #![a]
-   |     ^^^^^
+LL |     #![empty_attr]
+   |     ^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54726
    = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable
 
 error[E0658]: custom attributes cannot be applied to modules
-  --> $DIR/proc-macro-gates.rs:14:1
+  --> $DIR/proc-macro-gates.rs:13:1
    |
-LL | #[a]
-   | ^^^^
+LL | #[empty_attr]
+   | ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: custom attributes cannot be applied to modules
-  --> $DIR/proc-macro-gates.rs:18:5
+  --> $DIR/proc-macro-gates.rs:17:5
    |
-LL |     #![a]
-   |     ^^^^^
+LL |     #![empty_attr]
+   |     ^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token
-  --> $DIR/proc-macro-gates.rs:22:1
+  --> $DIR/proc-macro-gates.rs:21:1
    |
-LL | #[a = "y"]
-   | ^^^^^^^^^^
+LL | #[empty_attr = "y"]
+   | ^^^^^^^^^^^^^^^^^^^
 
 error[E0658]: custom attributes cannot be applied to statements
-  --> $DIR/proc-macro-gates.rs:31:5
+  --> $DIR/proc-macro-gates.rs:30:5
    |
-LL |     #[a]
-   |     ^^^^
+LL |     #[empty_attr]
+   |     ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: custom attributes cannot be applied to statements
-  --> $DIR/proc-macro-gates.rs:35:5
+  --> $DIR/proc-macro-gates.rs:34:5
    |
-LL |     #[a]
-   |     ^^^^
+LL |     #[empty_attr]
+   |     ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: custom attributes cannot be applied to statements
-  --> $DIR/proc-macro-gates.rs:39:5
+  --> $DIR/proc-macro-gates.rs:38:5
    |
-LL |     #[a]
-   |     ^^^^
+LL |     #[empty_attr]
+   |     ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: custom attributes cannot be applied to expressions
-  --> $DIR/proc-macro-gates.rs:43:14
+  --> $DIR/proc-macro-gates.rs:42:14
    |
-LL |     let _x = #[a] 2;
-   |              ^^^^
+LL |     let _x = #[identity_attr] 2;
+   |              ^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: custom attributes cannot be applied to expressions
-  --> $DIR/proc-macro-gates.rs:46:15
+  --> $DIR/proc-macro-gates.rs:45:15
    |
-LL |     let _x = [#[a] 2];
-   |               ^^^^
+LL |     let _x = [#[identity_attr] 2];
+   |               ^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: custom attributes cannot be applied to expressions
-  --> $DIR/proc-macro-gates.rs:49:14
+  --> $DIR/proc-macro-gates.rs:48:14
    |
-LL |     let _x = #[a] println!();
-   |              ^^^^
+LL |     let _x = #[identity_attr] println!();
+   |              ^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
@@ -97,8 +97,8 @@ LL |     let _x = #[a] println!();
 error[E0658]: procedural macros cannot be expanded to types
   --> $DIR/proc-macro-gates.rs:53:13
    |
-LL |     let _x: m!(u32) = 3;
-   |             ^^^^^^^
+LL |     let _x: identity!(u32) = 3;
+   |             ^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
@@ -106,44 +106,44 @@ LL |     let _x: m!(u32) = 3;
 error[E0658]: procedural macros cannot be expanded to patterns
   --> $DIR/proc-macro-gates.rs:54:12
    |
-LL |     if let m!(Some(_x)) = Some(3) {}
-   |            ^^^^^^^^^^^^
+LL |     if let identity!(Some(_x)) = Some(3) {}
+   |            ^^^^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: procedural macros cannot be expanded to statements
-  --> $DIR/proc-macro-gates.rs:56:5
+  --> $DIR/proc-macro-gates.rs:57:5
    |
-LL |     m!(struct S;);
-   |     ^^^^^^^^^^^^^^
+LL |     empty!(struct S;);
+   |     ^^^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: procedural macros cannot be expanded to statements
-  --> $DIR/proc-macro-gates.rs:57:5
+  --> $DIR/proc-macro-gates.rs:58:5
    |
-LL |     m!(let _x = 3;);
-   |     ^^^^^^^^^^^^^^^^
+LL |     empty!(let _x = 3;);
+   |     ^^^^^^^^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: procedural macros cannot be expanded to expressions
-  --> $DIR/proc-macro-gates.rs:59:14
+  --> $DIR/proc-macro-gates.rs:60:14
    |
-LL |     let _x = m!(3);
-   |              ^^^^^
+LL |     let _x = identity!(3);
+   |              ^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
 
 error[E0658]: procedural macros cannot be expanded to expressions
-  --> $DIR/proc-macro-gates.rs:60:15
+  --> $DIR/proc-macro-gates.rs:61:15
    |
-LL |     let _x = [m!(3)];
-   |               ^^^^^
+LL |     let _x = [empty!(3)];
+   |               ^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/54727
    = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable
diff --git a/src/test/ui/proc-macro/proc-macro-gates2.rs b/src/test/ui/proc-macro/proc-macro-gates2.rs
index 46b543a397c..35d7fc8042a 100644
--- a/src/test/ui/proc-macro/proc-macro-gates2.rs
+++ b/src/test/ui/proc-macro/proc-macro-gates2.rs
@@ -1,21 +1,20 @@
-// aux-build:proc-macro-gates.rs
+// aux-build:test-macros.rs
 
 #![feature(stmt_expr_attributes)]
 
-extern crate proc_macro_gates as foo;
-
-use foo::*;
+#[macro_use]
+extern crate test_macros;
 
 // NB. these errors aren't the best errors right now, but they're definitely
 // intended to be errors. Somehow using a custom attribute in these positions
 // should either require a feature gate or not be allowed on stable.
 
-fn _test6<#[a] T>() {}
+fn _test6<#[empty_attr] T>() {}
 //~^ ERROR: unknown to the compiler
 
 fn _test7() {
     match 1 {
-        #[a] //~ ERROR: unknown to the compiler
+        #[empty_attr] //~ ERROR: unknown to the compiler
         0 => {}
         _ => {}
     }
diff --git a/src/test/ui/proc-macro/proc-macro-gates2.stderr b/src/test/ui/proc-macro/proc-macro-gates2.stderr
index 0e8236f460f..8eeca99ab39 100644
--- a/src/test/ui/proc-macro/proc-macro-gates2.stderr
+++ b/src/test/ui/proc-macro/proc-macro-gates2.stderr
@@ -1,17 +1,17 @@
-error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future
-  --> $DIR/proc-macro-gates2.rs:13:11
+error[E0658]: The attribute `empty_attr` is currently unknown to the compiler and may have meaning added to it in the future
+  --> $DIR/proc-macro-gates2.rs:12:11
    |
-LL | fn _test6<#[a] T>() {}
-   |           ^^^^
+LL | fn _test6<#[empty_attr] T>() {}
+   |           ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future
-  --> $DIR/proc-macro-gates2.rs:18:9
+error[E0658]: The attribute `empty_attr` is currently unknown to the compiler and may have meaning added to it in the future
+  --> $DIR/proc-macro-gates2.rs:17:9
    |
-LL |         #[a]
-   |         ^^^^
+LL |         #[empty_attr]
+   |         ^^^^^^^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
diff --git a/src/test/ui/proc-macro/resolve-error.rs b/src/test/ui/proc-macro/resolve-error.rs
index bb242f30249..82607136f0b 100644
--- a/src/test/ui/proc-macro/resolve-error.rs
+++ b/src/test/ui/proc-macro/resolve-error.rs
@@ -1,7 +1,6 @@
 // aux-build:derive-foo.rs
 // aux-build:derive-clona.rs
-// aux-build:attr_proc_macro.rs
-// aux-build:bang_proc_macro.rs
+// aux-build:test-macros.rs
 
 #![feature(custom_attribute)]
 
@@ -9,11 +8,10 @@
 extern crate derive_foo;
 #[macro_use]
 extern crate derive_clona;
-extern crate attr_proc_macro;
-extern crate bang_proc_macro;
+extern crate test_macros;
 
-use attr_proc_macro::attr_proc_macro;
-use bang_proc_macro::bang_proc_macro;
+use test_macros::empty as bang_proc_macro;
+use test_macros::empty_attr as attr_proc_macro;
 
 macro_rules! FooWithLongNam {
     () => {}
diff --git a/src/test/ui/proc-macro/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr
index cf7de578c7d..705ef6006a0 100644
--- a/src/test/ui/proc-macro/resolve-error.stderr
+++ b/src/test/ui/proc-macro/resolve-error.stderr
@@ -1,47 +1,47 @@
 error: cannot find derive macro `FooWithLongNan` in this scope
-  --> $DIR/resolve-error.rs:26:10
+  --> $DIR/resolve-error.rs:24:10
    |
 LL | #[derive(FooWithLongNan)]
    |          ^^^^^^^^^^^^^^ help: try: `FooWithLongName`
 
 error: cannot find derive macro `Dlone` in this scope
-  --> $DIR/resolve-error.rs:36:10
+  --> $DIR/resolve-error.rs:34:10
    |
 LL | #[derive(Dlone)]
    |          ^^^^^ help: try: `Clone`
 
 error: cannot find derive macro `Dlona` in this scope
-  --> $DIR/resolve-error.rs:40:10
+  --> $DIR/resolve-error.rs:38:10
    |
 LL | #[derive(Dlona)]
    |          ^^^^^ help: try: `Clona`
 
 error: cannot find derive macro `attr_proc_macra` in this scope
-  --> $DIR/resolve-error.rs:44:10
+  --> $DIR/resolve-error.rs:42:10
    |
 LL | #[derive(attr_proc_macra)]
    |          ^^^^^^^^^^^^^^^
 
 error: cannot find macro `FooWithLongNama!` in this scope
-  --> $DIR/resolve-error.rs:49:5
+  --> $DIR/resolve-error.rs:47:5
    |
 LL |     FooWithLongNama!();
    |     ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam`
 
 error: cannot find macro `attr_proc_macra!` in this scope
-  --> $DIR/resolve-error.rs:52:5
+  --> $DIR/resolve-error.rs:50:5
    |
 LL |     attr_proc_macra!();
    |     ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac`
 
 error: cannot find macro `Dlona!` in this scope
-  --> $DIR/resolve-error.rs:55:5
+  --> $DIR/resolve-error.rs:53:5
    |
 LL |     Dlona!();
    |     ^^^^^
 
 error: cannot find macro `bang_proc_macrp!` in this scope
-  --> $DIR/resolve-error.rs:58:5
+  --> $DIR/resolve-error.rs:56:5
    |
 LL |     bang_proc_macrp!();
    |     ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro`
diff --git a/src/test/ui/proc-macro/shadow.rs b/src/test/ui/proc-macro/shadow.rs
index 9c49bae28a3..61959594c79 100644
--- a/src/test/ui/proc-macro/shadow.rs
+++ b/src/test/ui/proc-macro/shadow.rs
@@ -1,8 +1,8 @@
-// aux-build:derive-a.rs
+// aux-build:test-macros.rs
 
 #[macro_use]
-extern crate derive_a;
+extern crate test_macros;
 #[macro_use]
-extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times
+extern crate test_macros; //~ ERROR the name `test_macros` is defined multiple times
 
 fn main() {}
diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr
index 08057e16349..e7d95cc8358 100644
--- a/src/test/ui/proc-macro/shadow.stderr
+++ b/src/test/ui/proc-macro/shadow.stderr
@@ -1,13 +1,13 @@
-error[E0259]: the name `derive_a` is defined multiple times
+error[E0259]: the name `test_macros` is defined multiple times
   --> $DIR/shadow.rs:6:1
    |
-LL | extern crate derive_a;
-   | ---------------------- previous import of the extern crate `derive_a` here
+LL | extern crate test_macros;
+   | ------------------------- previous import of the extern crate `test_macros` here
 LL | #[macro_use]
-LL | extern crate derive_a;
-   | ^^^^^^^^^^^^^^^^^^^^^^ `derive_a` reimported here
+LL | extern crate test_macros;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ `test_macros` reimported here
    |
-   = note: `derive_a` must be defined only once in the type namespace of this module
+   = note: `test_macros` must be defined only once in the type namespace of this module
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/proc-macro/span-preservation.rs b/src/test/ui/proc-macro/span-preservation.rs
index 64f675ecc1c..0a82d28e9e5 100644
--- a/src/test/ui/proc-macro/span-preservation.rs
+++ b/src/test/ui/proc-macro/span-preservation.rs
@@ -1,19 +1,18 @@
 //~ ERROR mismatched types
-// aux-build:span-preservation.rs
+// aux-build:test-macros.rs
 
 // For each of these, we should get the appropriate type mismatch error message,
 // and the function should be echoed.
 
-extern crate span_preservation as foo;
+#[macro_use]
+extern crate test_macros;
 
-use foo::foo;
-
-#[foo]
+#[recollect_attr]
 fn a() {
     let x: usize = "hello";;;;; //~ ERROR mismatched types
 }
 
-#[foo]
+#[recollect_attr]
 fn b(x: Option<isize>) -> usize {
     match x {
         Some(x) => { return x }, //~ ERROR mismatched types
@@ -21,7 +20,7 @@ fn b(x: Option<isize>) -> usize {
     }
 }
 
-#[foo]
+#[recollect_attr]
 fn c() {
     struct Foo {
         a: usize
@@ -39,12 +38,12 @@ fn c() {
 // FIXME: This doesn't work at the moment. See the one below. The pretty-printer
 // injects a "C" between `extern` and `fn` which causes a "probably_eq"
 // `TokenStream` mismatch. The lack of `"C"` should be preserved in the AST.
-#[foo]
+#[recollect_attr]
 extern fn bar() {
     0
 }
 
-#[foo]
+#[recollect_attr]
 extern "C" fn baz() {
     0 //~ ERROR mismatched types
 }
diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr
index 1cc7706ce3a..cf03deee7e4 100644
--- a/src/test/ui/proc-macro/span-preservation.stderr
+++ b/src/test/ui/proc-macro/span-preservation.stderr
@@ -4,7 +4,7 @@ error[E0308]: mismatched types
               found type `{integer}`
 
 error[E0308]: mismatched types
-  --> $DIR/span-preservation.rs:13:20
+  --> $DIR/span-preservation.rs:12:20
    |
 LL |     let x: usize = "hello";;;;;
    |                    ^^^^^^^ expected usize, found reference
@@ -13,7 +13,7 @@ LL |     let x: usize = "hello";;;;;
               found type `&'static str`
 
 error[E0308]: mismatched types
-  --> $DIR/span-preservation.rs:19:29
+  --> $DIR/span-preservation.rs:18:29
    |
 LL | fn b(x: Option<isize>) -> usize {
    |                           ----- expected `usize` because of return type
@@ -22,13 +22,13 @@ LL |         Some(x) => { return x },
    |                             ^ expected usize, found isize
 
 error[E0308]: mismatched types
-  --> $DIR/span-preservation.rs:35:22
+  --> $DIR/span-preservation.rs:34:22
    |
 LL |     let x = Foo { a: 10isize };
    |                      ^^^^^^^ expected usize, found isize
 
 error[E0560]: struct `c::Foo` has no field named `b`
-  --> $DIR/span-preservation.rs:36:26
+  --> $DIR/span-preservation.rs:35:26
    |
 LL |     let y = Foo { a: 10, b: 10isize };
    |                          ^ `c::Foo` does not have this field
@@ -36,7 +36,7 @@ LL |     let y = Foo { a: 10, b: 10isize };
    = note: available fields are: `a`
 
 error[E0308]: mismatched types
-  --> $DIR/span-preservation.rs:49:5
+  --> $DIR/span-preservation.rs:48:5
    |
 LL | extern "C" fn baz() {
    |                     - possibly return type missing here?