Description
This is a tracking issue for the RFC "Named macro capture groups" (rust-lang/rfcs#3649).
The feature gate for the issue is #![feature(macro_named_capture_groups)]
.
macro_rules! foo {
( $group1( $a:ident ),+ ) => {
$group1( println!("{}", $a); )+
}
}
This feature is currently experimental to figure out ideal behavior; an RFC has not yet been accepted.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.
Steps
- Lang experiment request https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Lang.20experiment.20for.20named.20macro.20capture.20groups/with/525589974
- Implement the RFC (cc @rust-lang/XXX -- can anyone write up mentoring
instructions?) - Adjust documentation (see instructions on rustc-dev-guide)
- Style updates for any new syntax (nightly-style-procedure)
- Style team decision on new formatting
- Formatting for new syntax has been added to the Style Guide
- (non-blocking) Formatting has been implemented in
rustfmt
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
- What syntax should be used for groups?
$group(..)
in the capture is nice, but$group(..)
in the capture (expand the group) differs from$metavar(..)
(expand a metavar followed by a new group) and context is needed to handle this correctly.$'group
was proposed to avoid this.
- What syntax should be used for expanding the group in-place?
- Standalone
$group
is nice but there is no way to expand the entire group and add parens after ($group (..)
is ambiguous "expand group with parens" or "expand entire group, follow it by new parens") $...group
was proposed to avoid this.
- Standalone
XXX --- list all the "unresolved questions" found in the RFC to ensure they are
not forgotten