Skip to content

Commit e178b41

Browse files
committed
Address review
1 parent 9686a7a commit e178b41

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

non-msrv-tests/tests/ui/item.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ struct MissingCommaBetweenGenerics<T, U, V>(T, PhantomData<(U, V)>);
4141
#[derive_where("Clone")]
4242
struct InvalidTrait<T>(PhantomData<T>);
4343

44+
#[derive_where(Clone)]
45+
#[derive_where::derive_where(Copy)]
46+
struct QualifiedNotFirstMacro<T>(PhantomData<T>);
47+
4448
fn main() {}

non-msrv-tests/tests/ui/item.stderr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ error: empty `derive_where` found
1414
|
1515
= note: this error originates in the attribute macro `derive_where` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

17-
error: the `crate` option has to be defined in it's own `#[derive_where(..)` attribute
17+
error: unexpected option syntax
1818
--> tests/ui/item.rs:11:16
1919
|
2020
11 | #[derive_where(crate(derive_where_))]
21-
| ^^^^^
21+
| ^^^^^^^^^^^^^^^^^^^^
2222

2323
error: expected path, expected identifier
2424
--> tests/ui/item.rs:14:24
@@ -79,3 +79,11 @@ error: unexpected option syntax
7979
|
8080
41 | #[derive_where("Clone")]
8181
| ^^^^^^^
82+
83+
error: `#[derive_where(..)` was already applied to this item before, this occurs when using a qualified path for any `#[derive_where(..)`s except the first
84+
--> tests/ui/item.rs:44:1
85+
|
86+
44 | #[derive_where(Clone)]
87+
| ^^^^^^^^^^^^^^^^^^^^^^
88+
|
89+
= note: this error originates in the attribute macro `derive_where` (in Nightly builds, run with -Z macro-backtrace for more info)

src/attr/item.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ impl ItemAttr {
5454
// Don't parse `Skip` yet, because it needs access to all
5555
// `DeriveWhere`s.
5656
skip_inners.push(meta);
57-
} else if let Meta::NameValue(name_value) = meta {
58-
if name_value.path.is_ident("crate") {
57+
} else if meta.path().is_ident("crate") {
58+
if let Meta::NameValue(name_value) = meta {
5959
if let Lit::Str(lit_str) = &name_value.lit {
6060
match lit_str.parse::<Path>() {
6161
Ok(path) => {
@@ -93,7 +93,7 @@ impl ItemAttr {
9393
));
9494
}
9595
} else {
96-
return Err(Error::option_syntax(name_value.span()));
96+
return Err(Error::option_syntax(meta.span()));
9797
}
9898
}
9999
// The list can have one item but still not be the `skip_inner`

0 commit comments

Comments
 (0)