Allow `pat` macro matcher to be followed by `:`
Open
Nobody has claimed this yet.
A-macros
A-patterns
T-lang
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
Similarly to #1336, since function parameters can be destructured with patterns:
fn foo((x, y): (u32, u32)) -> u32 {
…
}
pat fragment specifiers should be able to be followed by :. The motivation case for this is something like:
macro_rules! terse {
($name:ident($($arg:pat : $type:ty),*) $body:block => {
fn $name<T>($($arg : $type),*) -> T
where really::long::and::tedious::Bound<That=Even, Has=Associated> + Types
$body
}
}
terse!{bar((x, y): (u32, u32)) {
…
}}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the related discussion in #1336 and the macro_rules! examples in this issue. Determine the design and implementation work needed for allowing a pat matcher to be followed by a colon in destructured parameters. Done means the syntax is accepted for the shown patterns and the behavior is covered by the relevant Rust tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100