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.
3131The derive feature of the crate has [ various uses in the
3232ecosystem] ( https://github.com/search?q=macro_rules_attribute%3A%3Aderive&type=code ) .
3333
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+
3443# Guide-level explanation
3544[ guide-level-explanation ] : #guide-level-explanation
3645
You can’t perform that action at this time.
0 commit comments