Skip to content

fix: Expand unmatched mbe fragments to reasonable default token trees #13384

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

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Oct 10, 2022

Currently we expand unmatched fragments by not replacing them at all, leaving us with $ident. This trips up the parser or subsequent macro calls. Instead it makes more sense to replace these with some reasonable default depending on the fragment kind which should make more recursive macro calls work better for completions.

Currently we expand unmatched fragments by not replacing them at all,
leaving us with `$ident`. This trips up the parser or subsequent macro
calls. Instead it makes more sense to replace these with some reasonable
default depending on the fragment kind which should make more recursive
macro calls work better for completions.
})))
}
MetaVarKind::Lifetime => {
Fragment::Tokens(tt::TokenTree::Leaf(tt::Leaf::Ident(tt::Ident {
Copy link
Member

Choose a reason for hiding this comment

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

Should \' need to include here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

' is already part of the identifier here "'lifetime"

@Veykril
Copy link
Member Author

Veykril commented Oct 10, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Oct 10, 2022

📌 Commit 78f33c0 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Oct 10, 2022

⌛ Testing commit 78f33c0 with merge 4ac3f2c...

@bors
Copy link
Contributor

bors commented Oct 10, 2022

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 4ac3f2c to master...

@bors bors merged commit 4ac3f2c into rust-lang:master Oct 10, 2022
bors added a commit that referenced this pull request Oct 10, 2022
Refactor completions expansion

Depends on #13384
Diff is unfortunately massive as I changed the functions in the analysis module from associated ones to standalone (unfortunately without an extra commit)
@lnicola lnicola changed the title Expand unmatched mbe fragments to reasonable default token trees fix: Expand unmatched mbe fragments to reasonable default token trees Oct 10, 2022
@Veykril Veykril deleted the macro-fallbacks branch October 28, 2022 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants