File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,15 @@ syntax as a proc macro.
31
31
The derive feature of the crate has [ various uses in the
32
32
ecosystem] ( https://github.com/search?q=macro_rules_attribute%3A%3Aderive&type=code ) .
33
33
34
+ ` derive ` macros have a standard syntax that Rust users have come to expect for
35
+ defining traits; this motivates providing users a way to invoke that mechanism
36
+ for declarative macros. An attribute or a ` macro_name! ` invocation could serve
37
+ the same purpose, but that would be less evocative than ` derive(Trait) ` for
38
+ the purposes of making the purpose of the macro clear, and would additionally
39
+ give the macro more power to rewrite the underlying definition. Derive macros
40
+ simplify tools like rust-analyzer, which can know that a derive macro will
41
+ never change the underlying item definition.
42
+
34
43
# Guide-level explanation
35
44
[ guide-level-explanation ] : #guide-level-explanation
36
45
You can’t perform that action at this time.
0 commit comments