diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-05-31 00:04:57 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2020-05-31 00:17:33 +0300 |
| commit | 4d5ce340cd643cbb775728cfd223a7a4b5281bae (patch) | |
| tree | e4f44f94c6c71a49381e538ac69cc1cbdb4dca26 /src | |
| parent | 74e80468347471779be6060d8d7d6d04e98e467f (diff) | |
| download | rust-4d5ce340cd643cbb775728cfd223a7a4b5281bae.tar.gz rust-4d5ce340cd643cbb775728cfd223a7a4b5281bae.zip | |
test-macros: Avoid always producing errors in `#[derive(Print)]`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/proc-macro/auxiliary/test-macros.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/dollar-crate.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/dollar-crate.stderr | 30 |
3 files changed, 5 insertions, 33 deletions
diff --git a/src/test/ui/proc-macro/auxiliary/test-macros.rs b/src/test/ui/proc-macro/auxiliary/test-macros.rs index 27efa44f980..fb8016cd438 100644 --- a/src/test/ui/proc-macro/auxiliary/test-macros.rs +++ b/src/test/ui/proc-macro/auxiliary/test-macros.rs @@ -108,5 +108,6 @@ pub fn print_attr(_: TokenStream, input: TokenStream) -> TokenStream { #[proc_macro_derive(Print, attributes(print_helper))] pub fn print_derive(input: TokenStream) -> TokenStream { - print_helper(input, "DERIVE") + print_helper(input, "DERIVE"); + TokenStream::new() } diff --git a/src/test/ui/proc-macro/dollar-crate.rs b/src/test/ui/proc-macro/dollar-crate.rs index aadd87ffaf2..5f2549376d1 100644 --- a/src/test/ui/proc-macro/dollar-crate.rs +++ b/src/test/ui/proc-macro/dollar-crate.rs @@ -1,3 +1,4 @@ +// check-pass // edition:2018 // aux-build:test-macros.rs // aux-build:dollar-crate-external.rs @@ -23,7 +24,7 @@ mod local { struct A($crate::S); #[derive(Print)] - struct D($crate::S); //~ ERROR the name `D` is defined multiple times + struct D($crate::S); }; } @@ -33,7 +34,7 @@ mod local { mod external { use crate::dollar_crate_external; - dollar_crate_external::external!(); //~ ERROR the name `D` is defined multiple times + dollar_crate_external::external!(); } fn main() {} diff --git a/src/test/ui/proc-macro/dollar-crate.stderr b/src/test/ui/proc-macro/dollar-crate.stderr deleted file mode 100644 index 465f242580d..00000000000 --- a/src/test/ui/proc-macro/dollar-crate.stderr +++ /dev/null @@ -1,30 +0,0 @@ -error[E0428]: the name `D` is defined multiple times - --> $DIR/dollar-crate.rs:26:13 - | -LL | struct D($crate::S); - | ^^^^^^^^^^^^^^^^^^^^ - | | - | `D` redefined here - | previous definition of the type `D` here -... -LL | local!(); - | --------- in this macro invocation - | - = note: `D` must be defined only once in the type namespace of this module - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0428]: the name `D` is defined multiple times - --> $DIR/dollar-crate.rs:36:5 - | -LL | dollar_crate_external::external!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | `D` redefined here - | previous definition of the type `D` here - | - = note: `D` must be defined only once in the type namespace of this module - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0428`. |
