Skip to content

Commit fc096f1

Browse files
committed
Correct how procedural macros are named
This is based on a suggestion by @eminence.
1 parent 0c11db8 commit fc096f1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/2018/transitioning/modules/macros.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ This moves `macro_rules` macros to be a bit closer to other kinds of items.
4444

4545
## Procedural macros
4646

47-
When using procedural macros to derive traits, you could have written:
47+
When using procedural macros to derive traits, you will have to name the macro
48+
that provides the custom derive. This generally matches the name of the trait,
49+
but check with the documentation of the crate providing the derives to be sure.
50+
51+
For example, with Serde you would have written
4852

4953
```rust,ignore
5054
// Rust 2015
@@ -66,8 +70,6 @@ use serde_derive::{Serialize, Deserialize};
6670
struct Bar;
6771
```
6872

69-
Note that the macros you have to import have the same name as the traits you want to derive.
70-
7173

7274
## More details
7375

0 commit comments

Comments
 (0)