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

Fixup path fragments upon MBE transcription #15360

Merged

Conversation

lowr
Copy link
Contributor

@lowr lowr commented Jul 30, 2023

Fixes #14367

There are roughly two types of paths: paths in expression context, where a separator :: between an identifier and its following generic argument list is mandatory, and paths in type context, where :: can be omitted.

Unlike rustc, we need to transform the parsed fragments back into tokens during transcription. When the matched path fragment is a type-context path and is transcribed as an expression-context path, verbatim transcription would cause a syntax error.

This PR fixes up path fragments by inserting :: to make sure they are syntactically correct in all contexts. Note that this works because expression-context paths are a strict superset of type-context paths.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 30, 2023
@HKalbasi
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 30, 2023

📌 Commit fd7435d has been approved by HKalbasi

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 30, 2023

⌛ Testing commit fd7435d with merge cecbed9...

@bors
Copy link
Collaborator

bors commented Jul 30, 2023

☀️ Test successful - checks-actions
Approved by: HKalbasi
Pushing cecbed9 to master...

1 similar comment
@bors
Copy link
Collaborator

bors commented Jul 30, 2023

☀️ Test successful - checks-actions
Approved by: HKalbasi
Pushing cecbed9 to master...

@bors
Copy link
Collaborator

bors commented Jul 30, 2023

👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request.

@bors bors merged commit cecbed9 into rust-lang:master Jul 30, 2023
10 checks passed
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.

path fragments do not get fixed up when used in pattern or expression contexts
4 participants