]> git.lizzy.rs Git - rust.git/commitdiff
tests: Centralize proc macros commonly used for testing
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Tue, 21 May 2019 22:09:58 +0000 (01:09 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Tue, 21 May 2019 23:20:34 +0000 (02:20 +0300)
72 files changed:
src/test/ui/custom-derive/auxiliary/plugin.rs [deleted file]
src/test/ui/custom-derive/derive-in-mod.rs [deleted file]
src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs [deleted file]
src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr [deleted file]
src/test/ui/custom-derive/helper-attr-blocked-by-import.rs [deleted file]
src/test/ui/custom-derive/issue-36935.rs [deleted file]
src/test/ui/custom-derive/issue-36935.stderr [deleted file]
src/test/ui/proc-macro/attribute-order-restricted.rs
src/test/ui/proc-macro/attribute-order-restricted.stderr
src/test/ui/proc-macro/attribute-with-error.rs
src/test/ui/proc-macro/attribute-with-error.stderr
src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs [deleted file]
src/test/ui/proc-macro/auxiliary/attribute-with-error.rs [deleted file]
src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs [deleted file]
src/test/ui/proc-macro/auxiliary/derive-a-b.rs [deleted file]
src/test/ui/proc-macro/auxiliary/derive-a.rs [deleted file]
src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs
src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs [deleted file]
src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs [deleted file]
src/test/ui/proc-macro/auxiliary/derive-panic.rs [deleted file]
src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs
src/test/ui/proc-macro/auxiliary/dollar-crate.rs [deleted file]
src/test/ui/proc-macro/auxiliary/issue-41211.rs [deleted file]
src/test/ui/proc-macro/auxiliary/issue-53481.rs [deleted file]
src/test/ui/proc-macro/auxiliary/macro-brackets.rs [deleted file]
src/test/ui/proc-macro/auxiliary/nested-item-spans.rs [deleted file]
src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs [deleted file]
src/test/ui/proc-macro/auxiliary/span-preservation.rs [deleted file]
src/test/ui/proc-macro/auxiliary/test-macros.rs
src/test/ui/proc-macro/derive-helper-shadowed.rs
src/test/ui/proc-macro/derive-helper-shadowing.rs
src/test/ui/proc-macro/derive-helper-shadowing.stderr
src/test/ui/proc-macro/derive-in-mod.rs [new file with mode: 0644]
src/test/ui/proc-macro/derive-still-gated.rs
src/test/ui/proc-macro/derive-still-gated.stderr
src/test/ui/proc-macro/dollar-crate-issue-57089.rs
src/test/ui/proc-macro/dollar-crate-issue-57089.stdout
src/test/ui/proc-macro/dollar-crate.rs
src/test/ui/proc-macro/dollar-crate.stderr
src/test/ui/proc-macro/dollar-crate.stdout
src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.rs [new file with mode: 0644]
src/test/ui/proc-macro/helper-attr-blocked-by-import-ambig.stderr [new file with mode: 0644]
src/test/ui/proc-macro/helper-attr-blocked-by-import.rs [new file with mode: 0644]
src/test/ui/proc-macro/import.rs
src/test/ui/proc-macro/import.stderr
src/test/ui/proc-macro/issue-36935.rs [new file with mode: 0644]
src/test/ui/proc-macro/issue-36935.stderr [new file with mode: 0644]
src/test/ui/proc-macro/issue-37788.rs
src/test/ui/proc-macro/issue-41211.rs
src/test/ui/proc-macro/issue-41211.stderr
src/test/ui/proc-macro/issue-53481.rs
src/test/ui/proc-macro/load-panic.rs
src/test/ui/proc-macro/load-panic.stderr
src/test/ui/proc-macro/macro-brackets.rs
src/test/ui/proc-macro/macro-use-attr.rs
src/test/ui/proc-macro/macro-use-bang.rs
src/test/ui/proc-macro/macros-in-extern.rs
src/test/ui/proc-macro/macros-in-extern.stderr
src/test/ui/proc-macro/nested-item-spans.rs
src/test/ui/proc-macro/nested-item-spans.stderr
src/test/ui/proc-macro/no-macro-use-attr.rs
src/test/ui/proc-macro/no-macro-use-attr.stderr
src/test/ui/proc-macro/proc-macro-gates.rs
src/test/ui/proc-macro/proc-macro-gates.stderr
src/test/ui/proc-macro/proc-macro-gates2.rs
src/test/ui/proc-macro/proc-macro-gates2.stderr
src/test/ui/proc-macro/resolve-error.rs
src/test/ui/proc-macro/resolve-error.stderr
src/test/ui/proc-macro/shadow.rs
src/test/ui/proc-macro/shadow.stderr
src/test/ui/proc-macro/span-preservation.rs
src/test/ui/proc-macro/span-preservation.stderr

diff --git a/src/test/ui/custom-derive/auxiliary/plugin.rs b/src/test/ui/custom-derive/auxiliary/plugin.rs
deleted file mode 100644 (file)
index 5e500de..0000000
+++ /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 (file)
index 8478ff1..0000000
+++ /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 (file)
index ba072ba..0000000
+++ /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 (file)
index e83c291..0000000
+++ /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 (file)
index abbf014..0000000
+++ /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 (file)
index 7a5d19f..0000000
+++ /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 (file)
index 2875bc5..0000000
+++ /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
-
index 7b1eecd1558659f4665d2978d9839febc9074710..a3d4d23450ca6f1e44c346c667e1ad97bfef83cf 100644 (file)
@@ -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() {}
index 39db45cf569a775d5421c49dd7be6af516d2d2c3..9ca8a443e40fbb5cf1fcb8015e279b10b4954ac6 100644 (file)
@@ -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
 
index 2cced40830a7414ba0d15438c634f0d58015a0f3..aaa6c07dddbbd402440a524a6cf102cb813bcd1a 100644 (file)
@@ -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 @@ fn foo(&self) {
 struct B;
 
 impl A for B {
-    #[foo]
+    #[recollect_attr]
     fn foo(&self) {
         let a: i32 = "foo";
         //~^ ERROR: mismatched types
     }
 }
 
-#[foo]
+#[recollect_attr]
 fn main() {
 }
index c5970ab6baaf865b586b049668d9f686cf24908c..937d47ff089798e66f2d8be8e423cbf76ed7e08f 100644 (file)
@@ -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 (file)
index b1f54be..0000000
+++ /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 (file)
index c073be0..0000000
+++ /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 (file)
index 16f3b76..0000000
+++ /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 (file)
index 64d4e0f..0000000
+++ /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 (file)
index c9d94ab..0000000
+++ /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()
-}
index 9912a89dafb3f0e799725e740baf8b623cb1ab5d..ab532da2992247ca5e6a7fb8fe45d79897bedd74 100644 (file)
@@ -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 (file)
index 5b5243d..0000000
+++ /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 (file)
index 6e0bdcb..0000000
+++ /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 (file)
index e2afa7a..0000000
+++ /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!");
-}
index 8f15a2b975bf342567e64c121c7cdd3cfac4b0f3..d5d393b5a6457df34cddb74fd0ad058a1694affa 100644 (file)
@@ -3,14 +3,14 @@
 #[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 (file)
index c5347d2..0000000
+++ /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 (file)
index db946e7..0000000
+++ /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 (file)
index d9f290d..0000000
+++ /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 (file)
index f2c62ab..0000000
+++ /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 (file)
index 8f720b4..0000000
+++ /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 (file)
index c7c7167..0000000
+++ /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 (file)
index 33c7968..0000000
+++ /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()
-}
index 15fe3804f9b4ff73c46a2784207715e90a471026..27efa44f980323a5948d336d6e88a788d3bf7959 100644 (file)
 // 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")
+}
index 792b54b3b945ae4a5f8e043934334b055896f912..0388e647b58aad7691f334de67c39ab8202380f8 100644 (file)
@@ -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() {}
index f6fe9f9fd8b304d48d4b081e1070c29c11210b9d..cdc0d6da94695c018f3752c1248b911d699606ac 100644 (file)
@@ -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;
         }
 
index fb86cabf939c47a84ccef28c1784cb06223c5543..ed6d30516562d5e50f17a425b385fed724776ad6 100644 (file)
@@ -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 (file)
index 0000000..e6b9132
--- /dev/null
@@ -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() {}
index 526eff39891ae95adc58aca7fa9a18a6142fa768..d895d26f26763385c630034d1fe31ecfba78bdb6 100644 (file)
@@ -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() {}
index d235343ff16188e1c2e7138ece81d56dc5cf96de..f299b5abdbc6be5d14a2e173593d78d4106be627 100644 (file)
@@ -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
index 2d54c07ff95309fba007bd0cbbc68c3649befb9f..2615db3e119f1366d9495631ba1a2e55f42c9fb1 100644 (file)
@@ -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);
     };
 }
index 618380d7f0bee8aae443bbba997c7972182f238f..0611fcb13f267dc17f471345ce1976df45be51b0 100644 (file)
@@ -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),
index 1460e9a3b2d55ab988a73ee675d9ccd313cd66a9..aadd87ffaf203e86d9af6bc23ebbc1c0058f3822 100644 (file)
@@ -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
         };
     }
index d1b836e7f6f2897f24848bd5bd898e65cc419f7c..5d78a8e1987292fa1cbd1149f10989a29b28e5b9 100644 (file)
@@ -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!();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index 454da53943054f8cf380ace5b7a327fb18e14209..3c88ee99842a26e27f2e717fc08ce453e0372c4d 100644 (file)
@@ -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 (file)
index 0000000..3a1c56e
--- /dev/null
@@ -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 (file)
index 0000000..012fb10
--- /dev/null
@@ -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 (file)
index 0000000..6d3e5ec
--- /dev/null
@@ -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() {}
index 8fbccdf1aed14cc51325b79f95cd79f953cce8b2..d1b1ff350695f10f2ca5aa63f316e910d549baa6 100644 (file)
@@ -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() {}
index 813a8ac2604605ce6c5ddbf813d2739d12d07ae3..aae621193ab9f3ea329765a7d36729560e88459e 100644 (file)
@@ -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 (file)
index 0000000..f809592
--- /dev/null
@@ -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 (file)
index 0000000..da4366e
--- /dev/null
@@ -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
+
index 75fcd24d85f6f80ec6cb198f98ce6bef8fa7786f..73b1f0d58c8371a5f6599204af953e51d0953117 100644 (file)
@@ -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.
index 0b082f4818f1b53fa32f72cc1e13df96ec721cd3..ee9246e1c9b5cf25b24b106b46696e4dd4164022 100644 (file)
@@ -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() {}
index dfb2f6f63d84706d56c6d65ac3c066b1847ee3e6..1de6b293ecfb8601633338a52fcd2f2538355a45 100644 (file)
@@ -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
 
index 479fd1db630a392b2350f637279650e954e43573..2fbde5fedb95b7527c9157f61a62fdeb6935b524 100644 (file)
@@ -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 {}
 }
 
index fa279c559fbf1890c70310e67490afe7daa12b57..2e9a311d882bd3019f107d6e11a4a28b1546e0bf 100644 (file)
@@ -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;
 
index b448c804bff598c513a27e5fc96726a1f0aed048..40cc4ee0e3d373246c2f41583dd90472b567e13d 100644 (file)
@@ -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
 
index c46abf03654ced7475e9f9396cbfd95b6b80e84f..aa0046f458229caeb5b6b58a7538a3b364017d8b 100644 (file)
@@ -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
 
 
index 13db0725a388b034c9d4794dbdd0d9bde929c85f..d1b1430fb5d034f5effb78dc6a711cfec95c0ddc 100644 (file)
@@ -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() {
index 4bf3bcd6f3aae5512e7e559c3753e78358741708..d39c42267fb96003d48941acaf05efdffe98c475 100644 (file)
@@ -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!"));
 }
index 5c5603b6c06b0491ad23e512bdd378a27a028b65..0477b5c48ecc9600bf5b67493f2736875d76d1cd 100644 (file)
@@ -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
 }
index 61571650f2f048733207c45929510d0a8d73a5c8..592c91553aa8cf6972a4100408365699bf9c0e8a 100644 (file)
@@ -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
index e365b74b3be8ff0dd826aa403388bba60eac2f43..63da170d0bbb263c130eccc5502cc5373e80886e 100644 (file)
@@ -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 bar() {
 }
 
 fn main() {
-    #[foo]
+    #[recollect_attr]
     fn bar() {
         let x: u32 = "x"; //~ ERROR: mismatched types
     }
index 011a91d446295855ab6998e47eea83c6ee7124c8..bef80311f38e5fa5f85c44b619d758ce975fba0f 100644 (file)
@@ -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
index 62a501ded1006a2eaec491850e589233cad0539a..15ab431fe754af5576fbaf600ba08e8635b649f0 100644 (file)
@@ -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]
index 4b2fce7f6e4caa1e6f65fc7e3998b61b311cfa3c..87487bcc7d6627526ecf15dcf57366d613c5a4ed 100644 (file)
@@ -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
index af6bfa08aaa942816d021297a60dc1ae334c9ebe..678dc83b753b5f7b5143b846833c62c37698b4d9 100644 (file)
@@ -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
 }
index 1bb864b52ea7d32a67f380e2d24471f59d24bdd5..f53ad222a036811c09746a32255496ccb8d98dfa 100644 (file)
@@ -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
index 46b543a397cc7ac5fe8904253af7bbbc2e85343f..35d7fc8042a3d838038b13df0ebf02893069e0a1 100644 (file)
@@ -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 => {}
         _ => {}
     }
index 0e8236f460f8ca2b5ae32d9baff86d1af8834857..8eeca99ab39849723675650240eed6a9e946d12b 100644 (file)
@@ -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
index bb242f302496e4ecfa79b620ece0f5beb745eb77..82607136f0b6f2d87ee4ff3dc3f6d162ab3ceacc 100644 (file)
@@ -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 {
     () => {}
index cf7de578c7d42f514f3aa93656a1bb8686543b70..705ef6006a049929573175538a1497428fab5fd4 100644 (file)
@@ -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`
index 9c49bae28a3bc78f9143080e84b4d61d7c999f0d..61959594c7981b3c6386ce30916d06f58f16e943 100644 (file)
@@ -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() {}
index 08057e163496dd633147ee3d5922ebe8f63760f9..e7d95cc8358117d0c24f480b3cba9b40758845d3 100644 (file)
@@ -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
 
index 64f675ecc1c4d1f3579e1eaff60cdc52ab3341cc..0a82d28e9e544f830964545c26fc85348233effd 100644 (file)
@@ -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 @@ struct Bar {
 // 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
 }
index 1cc7706ce3a4c6e86d304dc191867cc559a23c5a..cf03deee7e44554dd2003cfe1a7a723f156c8f01 100644 (file)
@@ -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?