Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ${count()} metavariable expression #14878

Merged
merged 2 commits into from
May 28, 2023

Conversation

lowr
Copy link
Contributor

@lowr lowr commented May 23, 2023

This PR implements ${count()} metavariable expression for MBE as described in RFC 3086. See this section of the RFC for its semantics.

Additionally, this PR changes the type of depth parameter of ${index()} from u32 to usize so as to match how rustc parses it.

Part of #11952
Fixes #14871

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 23, 2023
@lowr
Copy link
Contributor Author

lowr commented May 23, 2023

Opening as a draft since there are several things I'm uncertain about, but this should be enough to expand well-formed macro calls with ${count()}.

@lowr lowr force-pushed the feat/metavar-expr-count branch 2 times, most recently from bc521f1 to 616aa3f Compare May 28, 2023 10:34
@lowr lowr force-pushed the feat/metavar-expr-count branch from 616aa3f to 0d4d1d7 Compare May 28, 2023 10:57
@lowr lowr marked this pull request as ready for review May 28, 2023 11:08
@lowr
Copy link
Contributor Author

lowr commented May 28, 2023

Current implementation of rustc has several behaviors I consider a bug or underspecified; see rust-lang/rust#111904, rust-lang/rust#111905. I did implement those behaviors but they are pretty much edge cases and, as I said in my previous comment, we should be able to expand well-defined macros.

@Veykril
Copy link
Member

Veykril commented May 28, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented May 28, 2023

📌 Commit 0d4d1d7 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 28, 2023

⌛ Testing commit 0d4d1d7 with merge 150082b...

@bors
Copy link
Collaborator

bors commented May 28, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 150082b to master...

@bors bors merged commit 150082b into rust-lang:master May 28, 2023
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.

Autocomplete/hover broken in IndexMap with tuple key
4 participants