Skip to content

Implement pattern_type macro#22082

Open
Veykril wants to merge 1 commit intorust-lang:masterfrom
Veykril:push-plvylxqznwky
Open

Implement pattern_type macro#22082
Veykril wants to merge 1 commit intorust-lang:masterfrom
Veykril:push-plvylxqznwky

Conversation

@Veykril
Copy link
Copy Markdown
Member

@Veykril Veykril commented Apr 18, 2026

Does not implement actually type level things though

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 18, 2026
Comment thread crates/syntax/rust.ungram
ForBinder Type

PatternType =
'in' Type 'is' Pat
Copy link
Copy Markdown
Member Author

@Veykril Veykril Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is all hidden behind a macro right now I took the liberty of going with a prefix approach for parsing simplicity for now

View changes since the review

@Veykril Veykril force-pushed the push-plvylxqznwky branch 4 times, most recently from 5862154 to 7bcbc10 Compare April 18, 2026 13:36
@ChayimFriedman2
Copy link
Copy Markdown
Contributor

This does not support the !null pattern. I'm not sure if extending normal patterns will cause problems, and we need a special parser.

@Veykril
Copy link
Copy Markdown
Member Author

Veykril commented Apr 19, 2026

Yeas it doesn't, though I think !null is not yet used in the standard library 🤦 I even copied a counter-example into minicore. In that case I'd still like to merge the PR as is I think, can be fixed up as a follow up. Once again I wish the project wouldn't dogfood features in the standard libraries..

That does raise the question of what to do about the new type only pattern here. Ideally we would re-use the pattern grammar here as adding a new type-pattern grammar is a lot to deal with.

@Veykril Veykril force-pushed the push-plvylxqznwky branch 3 times, most recently from 61eff72 to 3f700bb Compare April 19, 2026 07:20
@Veykril Veykril force-pushed the push-plvylxqznwky branch from 3f700bb to 4e280bb Compare April 19, 2026 07:30
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 20, 2026

☔ The latest upstream changes (possibly #22101) made this pull request unmergeable. Please resolve the merge conflicts.

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

The problem of using it as normal pattern is that all other places dealing with patterns will need to deal it. I don't personally have an opinion what's better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants