Skip to content

Commit a525432

Browse files
committedJul 16, 2019
Document the automatically_derived attribute.
1 parent 8e7d614 commit a525432

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎src/attributes.md

+3
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ The following is an index of all built-in attributes.
185185
- [`should_panic`] — Indicates a test should generate a panic.
186186
- Derive
187187
- [`derive`] — Automatic trait implementations.
188+
- [`automatically_derived`] — Marker for implementations created by
189+
`derive`.
188190
- Macros
189191
- [`macro_export`] — Exports a `macro_rules` macro for cross-crate usage.
190192
- [`macro_use`] — Expands macro visibility, or imports macros from other
@@ -250,6 +252,7 @@ The following is an index of all built-in attributes.
250252
[_LiteralExpression_]: expressions/literal-expr.md
251253
[_SimplePath_]: paths.md#simple-paths
252254
[`allow`]: attributes/diagnostics.md#lint-check-attributes
255+
[`automatically_derived`]: attributes/derive.md#the-automatically_derived-attribute
253256
[`cfg_attr`]: conditional-compilation.md#the-cfg_attr-attribute
254257
[`cfg`]: conditional-compilation.md#the-cfg-attribute
255258
[`cold`]: attributes/codegen.md#the-cold-attribute

‎src/attributes/derive.md

+9
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,19 @@ impl<T: PartialEq> PartialEq for Foo<T> {
3333

3434
You can implement `derive` for your own traits through [procedural macros].
3535

36+
## The `automatically_derived` attribute
37+
38+
The *`automatically_derived` attribute* is automatically added to
39+
[implementations] created by the `derive` attribute for built-in traits. It
40+
has no direct effect, but it may be used by tools and diagnostic lints to
41+
detect these automatically generated implementations.
42+
3643
[_MetaListPaths_]: ../attributes.md#meta-item-attribute-syntax
3744
[`Clone`]: ../../std/clone/trait.Clone.html
3845
[`PartialEq`]: ../../std/cmp/trait.PartialEq.html
3946
[`impl` item]: ../items/implementations.md
4047
[items]: ../items.md
4148
[derive macros]: ../procedural-macros.md#derive-macros
49+
[implementations]: ../items/implementations.md
50+
[items]: ../items.md
4251
[procedural macros]: ../procedural-macros.md#derive-macros

0 commit comments

Comments
 (0)
Please sign in to comment.