rust-lang / rust-lang/rfcs

Pre-RFC: `bounds` macro matcher

Open
#2,520 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-lang
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

There is currently no sane way to match trait bounds in macros. To my knowledge, $a:path is the closest you can get, and that does not match 'static or other lifetimes.

The easiest answer to this is to add a $a:bounds matcher that matches trait bounds specifically. For example:

  • It would match Sync
  • It would match 'static
  • It would match Sync + Send + 'static

Then, accepting trait bounds in macros would be as '''simple''' as something like $(<$($bound_lt:lifetime),* $(,)? $($bound_p:ident: $bound_p_bound:bounds),* $(,)?>)? instead of complete insanity.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points; start by reviewing the proposed bounds matcher examples and the existing macro matcher behavior they compare against. Done would be a decided RFC design that specifies which trait bounds are accepted and how the matcher behaves for the listed cases.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.