Skip to content

Commit 1e09da0

Browse files
committed
Document the automatically_derived attribute.
1 parent 8bb0d86 commit 1e09da0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
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.html
251253
[_SimplePath_]: paths.html#simple-paths
252254
[`allow`]: attributes/diagnostics.html#lint-check-attributes
255+
[`automatically_derived`]: attributes/derive.html#the-automatically_derived-attribute
253256
[`cfg_attr`]: conditional-compilation.html#the-cfg_attr-attribute
254257
[`cfg`]: conditional-compilation.html#the-cfg-attribute
255258
[`cold`]: attributes/codegen.html#the-cold-attribute

src/attributes/derive.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,18 @@ 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.html#meta-item-attribute-syntax
3744
[`Clone`]: ../std/clone/trait.Clone.html
3845
[`PartialEq`]: ../std/cmp/trait.PartialEq.html
3946
[`impl` item]: items/implementations.html
40-
[items]: items.html
4147
[derive macros]: procedural-macros.html#derive-macros
48+
[implementations]: items/implementations.html
49+
[items]: items.html
4250
[procedural macros]: procedural-macros.html#derive-macros

0 commit comments

Comments
 (0)