@@ -48,47 +48,47 @@ Macros
4848 // Compliant implementation
4949 }
5050
51- .. guideline :: Shall not use Procedural Macros
52- :id: gui_m6BKTDzO2rdL
53- :category: mandatory
51+ .. guideline :: Procedural macros should not be used
52+ :id: gui_66FSqzD55VRZ
53+ :category: advisory
5454 :status: draft
55- :release: todo
55+ :release: 1.85.0;1.85.1
5656 :fls: fls_wn1i6hzg2ff7
5757 :decidability: decidable
58- :scope: system
59- :tags: reduce-human-error
58+ :scope: crate
59+ :tags: readability, reduce-human-error
6060
61- Description of the guideline goes here.
61+ Macros should be expressed using declarative syntax
62+ in preference to procedural syntax.
6263
6364 .. rationale ::
64- :id: rat_kAcNBmDhJ5W8
65+ :id: rat_AmCavSymv3Ev
6566 :status: draft
6667
67- Explanation of why this guideline is important.
68+ Procedural macros are not restricted to pure transcription and can contain arbitrary Rust code.
69+ This means they can be harder to understand, and cannot be as easily proved to work as intended.
70+ Procedural macros can have arbitrary side effects, which can exhaust compiler resources or
71+ expose a vulnerability for users of adopted code.
6872
6973 .. non_compliant_example ::
70- :id: non_compl_ex_xhIwlJPZYbVb
74+ :id: non_compl_ex_pJhVZW6a1HP9
7175 :status: draft
7276
73- Explanation of code example.
77+ (example of a simple expansion using a proc-macro)
7478
7579 .. code-block :: rust
7680
77- fn example_function() {
78- // Non-compliant implementation
79- }
81+ // TODO
8082
8183 .. compliant_example ::
82- :id: compl_ex_JxmIfJ7plkEf
84+ :id: compl_ex_4VFyucETB7C3
8385 :status: draft
8486
85- Explanation of code example.
87+ (example of the same simple expansion using a declarative macro)
8688
8789 .. code-block :: rust
8890
89- fn example_function() {
90- // Compliant implementation
91- }
91+ // TODO
9292
9393 .. guideline :: Shall not invoke macros
9494 :id: gui_a1mHfjgKk4Xr
0 commit comments