expand: Stop derive expansion un unexpected targets early
Collect derive placeholders using `collect` instead of `push`
This commit is contained in:
parent
ec547202b4
commit
cd2177f3de
9 changed files with 40 additions and 87 deletions
|
|
@ -1,5 +1,4 @@
|
|||
#![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions
|
||||
//~| ERROR cannot determine resolution for the derive macro `Copy`
|
||||
//~| ERROR cannot determine resolution for the derive macro `Copy`
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,6 @@ LL | #![derive(Copy)]
|
|||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the derive macro `Copy`
|
||||
--> $DIR/issue-36617.rs:1:11
|
||||
|
|
||||
LL | #![derive(Copy)]
|
||||
| ^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0774`.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
fn foo<#[derive(Debug)] T>() {
|
||||
//~^ ERROR `derive` may only be applied to structs, enums and unions
|
||||
//~| ERROR expected an inert attribute, found a derive macro
|
||||
match 0 {
|
||||
#[derive(Debug)]
|
||||
//~^ ERROR `derive` may only be applied to structs, enums and unions
|
||||
//~| ERROR expected an inert attribute, found a derive macro
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,24 +4,12 @@ error[E0774]: `derive` may only be applied to structs, enums and unions
|
|||
LL | fn foo<#[derive(Debug)] T>() {
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected an inert attribute, found a derive macro
|
||||
--> $DIR/issue-49934-errors.rs:1:17
|
||||
|
|
||||
LL | fn foo<#[derive(Debug)] T>() {
|
||||
| ^^^^^
|
||||
|
||||
error[E0774]: `derive` may only be applied to structs, enums and unions
|
||||
--> $DIR/issue-49934-errors.rs:5:9
|
||||
--> $DIR/issue-49934-errors.rs:4:9
|
||||
|
|
||||
LL | #[derive(Debug)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: expected an inert attribute, found a derive macro
|
||||
--> $DIR/issue-49934-errors.rs:5:18
|
||||
|
|
||||
LL | #[derive(Debug)]
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0774`.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ struct CLI {
|
|||
#[derive(parse())]
|
||||
//~^ ERROR traits in `#[derive(...)]` don't accept arguments
|
||||
//~| ERROR cannot find derive macro `parse` in this scope
|
||||
//~| ERROR cannot find derive macro `parse` in this scope
|
||||
path: (),
|
||||
//~^ ERROR `derive` may only be applied to structs, enums and unions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | #[derive(parse())]
|
|||
| ^^ help: remove the arguments
|
||||
|
||||
error[E0774]: `derive` may only be applied to structs, enums and unions
|
||||
--> $DIR/issue-69341-malformed-derive-inert.rs:8:5
|
||||
--> $DIR/issue-69341-malformed-derive-inert.rs:7:5
|
||||
|
|
||||
LL | path: (),
|
||||
| ^^^^^^^^
|
||||
|
|
@ -16,12 +16,6 @@ error: cannot find derive macro `parse` in this scope
|
|||
LL | #[derive(parse())]
|
||||
| ^^^^^
|
||||
|
||||
error: cannot find derive macro `parse` in this scope
|
||||
--> $DIR/issue-69341-malformed-derive-inert.rs:4:14
|
||||
|
|
||||
LL | #[derive(parse())]
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0774`.
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@
|
|||
//~| ERROR cannot determine resolution for the derive macro `Debug`
|
||||
//~| ERROR cannot determine resolution for the derive macro `PartialEq`
|
||||
//~| ERROR cannot determine resolution for the derive macro `Eq`
|
||||
//~| ERROR cannot determine resolution for the derive macro `Debug`
|
||||
//~| ERROR cannot determine resolution for the derive macro `PartialEq`
|
||||
//~| ERROR cannot determine resolution for the derive macro `Eq`
|
||||
struct DerivedOn;
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -28,30 +28,6 @@ LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
|
|||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the derive macro `Eq`
|
||||
--> $DIR/issue-43927-non-ADT-derive.rs:3:29
|
||||
|
|
||||
LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
|
||||
| ^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the derive macro `PartialEq`
|
||||
--> $DIR/issue-43927-non-ADT-derive.rs:3:18
|
||||
|
|
||||
LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: cannot determine resolution for the derive macro `Debug`
|
||||
--> $DIR/issue-43927-non-ADT-derive.rs:3:11
|
||||
|
|
||||
LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute!
|
||||
| ^^^^^
|
||||
|
|
||||
= note: import resolution is stuck, try simplifying macro imports
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0774`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue