Skip to content

Commit 05189cf

Browse files
authored
Merge pull request #555 from ehuss/automatically_derived
Document the `automatically_derived` attribute.
2 parents e32eac4 + a525432 commit 05189cf

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
@@ -187,6 +187,8 @@ The following is an index of all built-in attributes.
187187
- [`should_panic`] — Indicates a test should generate a panic.
188188
- Derive
189189
- [`derive`] — Automatic trait implementations.
190+
- [`automatically_derived`] — Marker for implementations created by
191+
`derive`.
190192
- Macros
191193
- [`macro_export`] — Exports a `macro_rules` macro for cross-crate usage.
192194
- [`macro_use`] — Expands macro visibility, or imports macros from other
@@ -255,6 +257,7 @@ The following is an index of all built-in attributes.
255257
[_LiteralExpression_]: expressions/literal-expr.md
256258
[_SimplePath_]: paths.md#simple-paths
257259
[`allow`]: attributes/diagnostics.md#lint-check-attributes
260+
[`automatically_derived`]: attributes/derive.md#the-automatically_derived-attribute
258261
[`cfg_attr`]: conditional-compilation.md#the-cfg_attr-attribute
259262
[`cfg`]: conditional-compilation.md#the-cfg-attribute
260263
[`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)