1
- error: `#[derive(From)]` can only be used on structs with a single field
2
- --> $DIR/deriving-from-wrong-target.rs:8:1
1
+ error: `#[derive(From)]` used on a struct with no fields
2
+ --> $DIR/deriving-from-wrong-target.rs:7:10
3
3
|
4
+ LL | #[derive(From)]
5
+ | ^^^^
6
+ LL |
4
7
LL | struct S1;
5
- | ^^^^^^^^^^
8
+ | ^^
9
+ |
10
+ = note: `#[derive(From)]` can only be used on structs with exactly one field
6
11
7
- error: `#[derive(From)]` can only be used on structs with a single field
8
- --> $DIR/deriving-from-wrong-target.rs:12:1
12
+ error: `#[derive(From)]` used on a struct with no fields
13
+ --> $DIR/deriving-from-wrong-target.rs:11:10
9
14
|
15
+ LL | #[derive(From)]
16
+ | ^^^^
17
+ LL |
10
18
LL | struct S2 {}
11
- | ^^^^^^^^^^^^
19
+ | ^^
20
+ |
21
+ = note: `#[derive(From)]` can only be used on structs with exactly one field
12
22
13
- error: `#[derive(From)]` can only be used on structs with a single field
14
- --> $DIR/deriving-from-wrong-target.rs:16:1
23
+ error: `#[derive(From)]` used on a struct with multiple fields
24
+ --> $DIR/deriving-from-wrong-target.rs:15:10
15
25
|
26
+ LL | #[derive(From)]
27
+ | ^^^^
28
+ LL |
16
29
LL | struct S3(u32, bool);
17
- | ^^^^^^^^^^^^^^^^^^^^^
30
+ | ^^
31
+ |
32
+ = note: `#[derive(From)]` can only be used on structs with exactly one field
18
33
19
- error: `#[derive(From)]` can only be used on structs with a single field
20
- --> $DIR/deriving-from-wrong-target.rs:21:1
21
- |
22
- LL | / struct S4 {
23
- LL | | a: u32,
24
- LL | | b: bool,
25
- LL | | }
26
- | |_^
34
+ error: `#[derive(From)]` used on a struct with multiple fields
35
+ --> $DIR/deriving-from-wrong-target.rs:19:10
36
+ |
37
+ LL | #[derive(From)]
38
+ | ^^^^
39
+ LL |
40
+ LL | struct S4 {
41
+ | ^^
42
+ |
43
+ = note: `#[derive(From)]` can only be used on structs with exactly one field
27
44
28
- error: `#[derive(From)]` can only be used on structs with a single field
29
- --> $DIR/deriving-from-wrong-target.rs:27:1
45
+ error: `#[derive(From)]` used on an enum
46
+ --> $DIR/deriving-from-wrong-target.rs:26:10
30
47
|
48
+ LL | #[derive(From)]
49
+ | ^^^^
50
+ LL |
31
51
LL | enum E1 {}
32
- | ^^^^^^^^^^
33
-
34
- error: `#[derive(From)]` can only be used on structs with a single field
35
- --> $DIR/deriving-from-wrong-target.rs:32:1
36
- |
37
- LL | / enum E2 {
38
- LL | | V1,
39
- LL | | V2,
40
- LL | | }
41
- | |_^
42
-
43
- error: `#[derive(From)]` can only be used on structs with a single field
44
- --> $DIR/deriving-from-wrong-target.rs:39:1
45
- |
46
- LL | / enum E3 {
47
- LL | | V1(u32),
48
- LL | | V2(bool),
49
- LL | | }
50
- | |_^
52
+ | ^^
53
+ |
54
+ = note: `#[derive(From)]` can only be used on structs with exactly one field
51
55
52
56
error[E0277]: the size for values of type `T` cannot be known at compilation time
53
- --> $DIR/deriving-from-wrong-target.rs:44 :10
57
+ --> $DIR/deriving-from-wrong-target.rs:30 :10
54
58
|
55
59
LL | #[derive(From)]
56
60
| ^^^^ doesn't have a size known at compile-time
@@ -67,7 +71,7 @@ LL + struct SUnsizedField<T> {
67
71
|
68
72
69
73
error[E0277]: the size for values of type `T` cannot be known at compilation time
70
- --> $DIR/deriving-from-wrong-target.rs:44 :10
74
+ --> $DIR/deriving-from-wrong-target.rs:30 :10
71
75
|
72
76
LL | #[derive(From)]
73
77
| ^^^^ doesn't have a size known at compile-time
@@ -76,7 +80,7 @@ LL | struct SUnsizedField<T: ?Sized> {
76
80
| - this type parameter needs to be `Sized`
77
81
|
78
82
note: required because it appears within the type `SUnsizedField<T>`
79
- --> $DIR/deriving-from-wrong-target.rs:47 :8
83
+ --> $DIR/deriving-from-wrong-target.rs:33 :8
80
84
|
81
85
LL | struct SUnsizedField<T: ?Sized> {
82
86
| ^^^^^^^^^^^^^
@@ -88,7 +92,7 @@ LL + struct SUnsizedField<T> {
88
92
|
89
93
90
94
error[E0277]: the size for values of type `T` cannot be known at compilation time
91
- --> $DIR/deriving-from-wrong-target.rs:48 :11
95
+ --> $DIR/deriving-from-wrong-target.rs:34 :11
92
96
|
93
97
LL | struct SUnsizedField<T: ?Sized> {
94
98
| - this type parameter needs to be `Sized`
@@ -106,6 +110,6 @@ help: function arguments must have a statically known size, borrowed types alway
106
110
LL | last: &T,
107
111
| +
108
112
109
- error: aborting due to 10 previous errors
113
+ error: aborting due to 8 previous errors
110
114
111
115
For more information about this error, try `rustc --explain E0277`.
0 commit comments