mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-17 14:36:49 +00:00
test-macros: Avoid always producing errors in #[derive(Print)]
This commit is contained in:
parent
74e8046834
commit
4d5ce340cd
@ -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()
|
||||
}
|
||||
|
@ -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() {}
|
||||
|
@ -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`.
|
Loading…
Reference in New Issue
Block a user