File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -322,16 +322,20 @@ Macros
322
322
implementations. It's possible to use procedural macros or declarative macros
323
323
to do so.
324
324
325
- In a declarative macro the ordering of the patterns will be the order that
326
- they are matched against which can lead to unexpected behavior in the case
327
- where we have unique behavior intended for a particular expression. The concern
328
- in particular is that while the ordering may be done correctly when the
329
- macro match rules are written, it's possible in a refactor for them to
325
+ The choice of which `transcriber `_
326
+ is being used in a declarative macro depends on their declaration order within the macro.
327
+ This can lead to unexpected behavior changes in invocations of declarative macros if a new
328
+ transciber is inserted before another due to invocations suddenly matching a different transcriber.
329
+
330
+ The concern in particular is that while the declaration ordering may be done correctly
331
+ when the macro match rules are written, it's possible in a refactor for them to
330
332
unintentionally be moved around in order.
331
333
332
334
If needing to specialize logic within the macro based on a particular
333
335
expression's value, it is better to not use a declarative macro with multiple rules.
334
336
337
+ .. _transcriber : https://doc.rust-lang.org/reference/macros-by-example.html
338
+
335
339
.. non_compliant_example ::
336
340
:id: non_compl_ex_5vK0CCmePkef
337
341
:status: draft
You can’t perform that action at this time.
0 commit comments