File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,18 @@ If a derive macro mistakenly emits the token stream it was applied to
70
70
the duplicate item should hint to the user that the macro was defined
71
71
incorrectly, and remind the user that derive macros only append new items.
72
72
73
+ A ` derive() ` rule can be marked as ` unsafe ` : `unsafe derive() (...)
74
+ => { ... }`. Invoking such a derive using a rule marked as unsafe
75
+ requires unsafe derive syntax: either
76
+ ` #[unsafe(derive(DangerousTrait))] ` or
77
+ ` #[derive(unsafe(DangerousTrait))] ` . (The latter syntax allows
78
+ isolating the ` unsafe ` to a single derive within a list of
79
+ derives.) Invoking an unsafe derive rule without the unsafe derive
80
+ syntax will produce a compiler error. Using the unsafe derive
81
+ syntax without an unsafe derive will trigger an "unused unsafe"
82
+ lint. (RFC 3715 defines the equivalent mechanism for proc macro
83
+ derives.)
84
+
73
85
# Drawbacks
74
86
[ drawbacks ] : #drawbacks
75
87
You can’t perform that action at this time.
0 commit comments