Skip to content

Commit 38e48fb

Browse files
committed
Address review
1 parent e178b41 commit 38e48fb

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ struct WrongCrateSyntax<T>(PhantomData<T>);
1414
#[derive_where(crate = "struct Test")]
1515
struct InvalidPath<T>(PhantomData<T>);
1616

17+
// The error message here shows that `crate = ".."` should be in it's own
18+
// attribute instead of an error pointing out this is duplicate. This is not
19+
// ideal but much less complicated to implement.
1720
#[derive_where(crate = "derive_where_", crate = "derive_where_")]
1821
struct DuplicateCrate1<T>(PhantomData<T>);
1922

23+
#[derive_where(crate = "derive_where_")]
24+
#[derive_where(crate = "derive_where_")]
25+
struct DuplicateCrate2<T>(PhantomData<T>);
26+
2027
#[derive_where(crate = "derive_where_")]
2128
struct OnlyCrate<T>(PhantomData<T>);
2229

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

+26-20
Original file line numberDiff line numberDiff line change
@@ -27,63 +27,69 @@ error: expected path, expected identifier
2727
| ^^^^^^^^^^^^^
2828

2929
error: the `crate` option has to be defined in it's own `#[derive_where(..)` attribute
30-
--> tests/ui/item.rs:17:16
30+
--> tests/ui/item.rs:20:16
3131
|
32-
17 | #[derive_where(crate = "derive_where_", crate = "derive_where_")]
32+
20 | #[derive_where(crate = "derive_where_", crate = "derive_where_")]
3333
| ^^^^^
3434

35+
error: duplicate `crate` option
36+
--> tests/ui/item.rs:24:16
37+
|
38+
24 | #[derive_where(crate = "derive_where_")]
39+
| ^^^^^^^^^^^^^^^^^^^^^^^
40+
3541
error: no traits found to implement, use `#[derive_where(..)` to specify some
36-
--> tests/ui/item.rs:21:1
42+
--> tests/ui/item.rs:28:1
3743
|
38-
21 | struct OnlyCrate<T>(PhantomData<T>);
44+
28 | struct OnlyCrate<T>(PhantomData<T>);
3945
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4046

4147
error: unnecessary path qualification, `::derive_where` is used by default
42-
--> tests/ui/item.rs:23:24
48+
--> tests/ui/item.rs:30:24
4349
|
44-
23 | #[derive_where(crate = "::derive_where")]
50+
30 | #[derive_where(crate = "::derive_where")]
4551
| ^^^^^^^^^^^^^^^^
4652

4753
error: expected `,`
48-
--> tests/ui/item.rs:26:24
54+
--> tests/ui/item.rs:33:24
4955
|
50-
26 | #[derive_where(Clone; T;)]
56+
33 | #[derive_where(Clone; T;)]
5157
| ^
5258

5359
error: expected type to bind to, expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime
54-
--> tests/ui/item.rs:29:25
60+
--> tests/ui/item.rs:36:25
5561
|
56-
29 | #[derive_where(Clone; T,,)]
62+
36 | #[derive_where(Clone; T,,)]
5763
| ^
5864

5965
error: expected type to bind to, expected one of: `for`, parentheses, `fn`, `unsafe`, `extern`, identifier, `::`, `<`, square brackets, `*`, `&`, `!`, `impl`, `_`, lifetime
60-
--> tests/ui/item.rs:32:23
66+
--> tests/ui/item.rs:39:23
6167
|
62-
32 | #[derive_where(Clone; where)]
68+
39 | #[derive_where(Clone; where)]
6369
| ^^^^^
6470

6571
error: expected `;` or `,
66-
--> tests/ui/item.rs:35:22
72+
--> tests/ui/item.rs:42:22
6773
|
68-
35 | #[derive_where(Clone Debug)]
74+
42 | #[derive_where(Clone Debug)]
6975
| ^^^^^
7076

7177
error: expected `,`
72-
--> tests/ui/item.rs:38:25
78+
--> tests/ui/item.rs:45:25
7379
|
74-
38 | #[derive_where(Clone; T U)]
80+
45 | #[derive_where(Clone; T U)]
7581
| ^
7682

7783
error: unexpected option syntax
78-
--> tests/ui/item.rs:41:16
84+
--> tests/ui/item.rs:48:16
7985
|
80-
41 | #[derive_where("Clone")]
86+
48 | #[derive_where("Clone")]
8187
| ^^^^^^^
8288

8389
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
90+
--> tests/ui/item.rs:51:1
8591
|
86-
44 | #[derive_where(Clone)]
92+
51 | #[derive_where(Clone)]
8793
| ^^^^^^^^^^^^^^^^^^^^^^
8894
|
8995
= note: this error originates in the attribute macro `derive_where` (in Nightly builds, run with -Z macro-backtrace for more info)

0 commit comments

Comments
 (0)