@@ -67,40 +67,42 @@ r[attributes.derive.automatically_derived]
67
67
## The `automatically_derived ` attribute
68
68
69
69
r [attributes . derive. automatically_derived. intro]
70
- The * `automatically_derived ` [attribute ][attributes ]* is used to annotate an [implementation ] to indicate that it was automatically created by a ` derive ` attribute . It has no direct effect , but it may be used by tools and diagnostic lints to detect these automatically generated implementations .
70
+ The * `automatically_derived ` [attribute ][attributes ]* is used to annotate an [implementation ] to indicate that it was automatically created by a [ derive macro ] . It has no direct effect , but it may be used by tools and diagnostic lints to detect these automatically generated implementations .
71
71
72
72
> [! EXAMPLE ]
73
- > The following is an example of what the [`Clone `] derive may generate for a struct named `Example `.
73
+ > Given [`#[derive(Clone )]`][macro @ Clone ] on `struct Example `, the [derive macro ] may produce :
74
+ >
74
75
> ```rust
75
76
> # struct Example ;
76
77
> #[automatically_derived]
77
78
> impl :: core :: clone :: Clone for Example {
78
79
> #[inline]
79
- > fn clone (& self ) -> Example {
80
+ > fn clone (& self ) -> Self {
80
81
> Example
81
82
> }
82
83
> }
83
84
> ```
84
85
85
86
r [attributes . derive. automatically_derived. syntax]
86
- The `automatically_derived ` attribute uses the [MetaWord ] syntax and thus does not take any inputs .
87
+ The `automatically_derived ` attribute uses the [MetaWord ] syntax and so does not accept any arguments .
87
88
88
89
r [attributes . derive. automatically_derived. allowed- positions ]
89
90
The `automatically_derived ` attribute may be placed on an [implementation ].
90
91
91
92
> [! NOTE ]
92
- > `rustc ` currently warns in other positions .
93
+ > `rustc ` currently accepts the attribute in other positions but lints against it .
93
94
94
95
r [attributes . derive. automatically_derived. duplicates]
95
96
Duplicate instances of the `automatically_derived ` attribute on the same implementation have no effect .
96
97
97
98
> [! NOTE ]
98
- > `rustc ` currently warns on subsequent duplicate ` automatically_derived ` attributes .
99
+ > `rustc ` lints against duplicate use of this attribute .
99
100
100
101
r[attributes. derive. automatically_derived. behavior]
101
102
The `automatically_derived` attribute has no behavior.
102
103
103
104
[items]: .. / items. md
105
+ [derive macro ]: macro . proc. derive
104
106
[derive macros]: .. / procedural- macros. md#derive- macros
105
107
[implementation]: .. / items/ implementations. md
106
108
[items]: .. / items. md
0 commit comments