We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1ad3e9d commit 0032122Copy full SHA for 0032122
text/0000-or-patterns.md
@@ -433,6 +433,19 @@ You can also use `p | q` in:
433
This restriction is currently enforced to avoid backtracking but may possibly
434
be lifted in the future based on other developments in the grammar.
435
436
+6. macros by example:
437
+
438
+ ```rust
439
+ macro_rules! foo {
440
+ ($p:pat) => { ... }
441
+ }
442
443
+ foo!((Ok(x) | Err(x)));
444
+ ```
445
446
+ Here we must wrap the pattern in parenthesis since `$p:pat | $q:pat` is
447
+ already legal in patterns.
448
449
# Reference-level explanation
450
[reference-level-explanation]: #reference-level-explanation
451
0 commit comments