Bring our TokenTree model closer to rustc's #17830
Draft
+1,203
−1,031
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our model is kind of arbitrary and less strict, the syntax node <-> TokenTree conversion is also messy and brittle, likewise our MBE infra will benefit from a more concise model. Lastly, rustc uses this one
TokenStream
model for the parser, be it from macro inputs/outputs or general lexing where as we have a very confusing and inefficient setup to make this work for our parser. Ideally we should do a similar move and switch to a unified input there which ought to aid perf quite a bit when transcribing MBE macros.