Skip to content

Conversation

RalfJung
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

Aaron1011 and others added 7 commits May 22, 2020 15:01
…lity, r=petrochenkov

Recursively expand `TokenKind::Interpolated` in `probably_equal_for_proc_macro`

Fixes rust-lang#68430

When comparing the captured and re-parsed `TokenStream` for a `TokenKind::Interpolated`, we currently treat any nested `TokenKind::Interpolated` tokens as unequal. If a `TokenKind::Interpolated` token shows up in the captured `TokenStream` due to a `macro_rules!` expansion, we will throw away the captured `TokenStream`, losing span information.

This PR recursively invokes `nt_to_tokenstream` on nested `TokenKind::Interpolated` tokens, effectively flattening the stream into a sequence of non-interpolated tokens. This allows it to compare equal with the re-parsed stream, allowing us to keep the original captured `TokenStream` (with span information).

This requires all of the `probably_equal_for_proc_macro` methods to be moved from `librustc_ast` to `librustc_parse` so that they can call `nt_to_tokenstream`.
@RalfJung
Copy link
Member Author

RalfJung commented May 24, 2020

@rustbot modify labels: +rollup
@bors r+ rollup=never p=2

@bors
Copy link
Collaborator

bors commented May 24, 2020

📌 Commit 6cb1c0e has been approved by RalfJung

@rustbot rustbot added the rollup A PR which is a rollup label May 24, 2020
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 24, 2020
@bors

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented May 24, 2020

📌 Commit 6cb1c0e has been approved by RalfJung

@bors
Copy link
Collaborator

bors commented May 24, 2020

⌛ Testing commit 6cb1c0e with merge 7726070...

@bors
Copy link
Collaborator

bors commented May 24, 2020

☀️ Test successful - checks-azure
Approved by: RalfJung
Pushing 7726070 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 24, 2020
@bors bors merged commit 7726070 into rust-lang:master May 24, 2020
@bors bors mentioned this pull request May 24, 2020
@RalfJung RalfJung deleted the rollup-s9f1pcc branch May 25, 2020 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants