defatalize ProcMacroDerive::expand

Also remove ExtCtxt::struct_span_fatal.
This commit is contained in:
Mazdak Farrokhzad 2020-03-17 11:30:53 +01:00
parent ce8880d1d8
commit c1ef1b3bca
6 changed files with 44 additions and 33 deletions

View file

@ -3,11 +3,9 @@
#[macro_use]
extern crate derive_bad;
#[derive(
A
)]
//~^^ ERROR proc-macro derive produced unparseable tokens
#[derive(A)]
//~^ ERROR proc-macro derive produced unparseable tokens
//~| ERROR expected `:`, found `}`
struct A;
struct A; //~ ERROR the name `A` is defined multiple times
fn main() {}

View file

@ -1,16 +1,28 @@
error: expected `:`, found `}`
--> $DIR/derive-bad.rs:7:5
--> $DIR/derive-bad.rs:6:10
|
LL | A
| ^ expected `:`
LL | #[derive(A)]
| ^ expected `:`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: proc-macro derive produced unparseable tokens
--> $DIR/derive-bad.rs:7:5
--> $DIR/derive-bad.rs:6:10
|
LL | A
| ^
LL | #[derive(A)]
| ^
error: aborting due to 2 previous errors
error[E0428]: the name `A` is defined multiple times
--> $DIR/derive-bad.rs:9:1
|
LL | #[derive(A)]
| - previous definition of the type `A` here
...
LL | struct A;
| ^^^^^^^^^ `A` redefined here
|
= note: `A` must be defined only once in the type namespace of this module
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0428`.

View file

@ -5,6 +5,7 @@ extern crate test_macros;
#[derive(Identity, Panic)] //~ ERROR proc-macro derive panicked
struct Baz {
//~^ ERROR the name `Baz` is defined multiple times
a: i32,
b: i32,
}

View file

@ -6,5 +6,17 @@ LL | #[derive(Identity, Panic)]
|
= help: message: panic-derive
error: aborting due to previous error
error[E0428]: the name `Baz` is defined multiple times
--> $DIR/issue-36935.rs:7:1
|
LL | struct Baz {
| ^^^^^^^^^^
| |
| `Baz` redefined here
| previous definition of the type `Baz` here
|
= note: `Baz` must be defined only once in the type namespace of this module
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0428`.