Skip to content

internal: switch from trait-based TokenSource to simple struct of arrays #10995

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 11 commits into from
Dec 12, 2021

Conversation

matklad
Copy link
Member

@matklad matklad commented Dec 12, 2021

cc #10765

The idea here is to try to simplify the interface as best as we can. The original trait-based approach is a bit over-engineered and hard to debug. Here, we replace callback with just data. The next PR in series will replace the output TreeSink trait with data as well.

The biggest drawback here is that we now require to materialize all parser's input up-front. This is a bad fit for macro by example: when you parse $e:expr, you might consume only part of the input. However, today's trait-based solution doesn't really help -- we were already materializing the whole thing! So, let's keep it simple!

Copy link
Member Author

@matklad matklad left a comment

Choose a reason for hiding this comment

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

bors r+

@matklad matklad mentioned this pull request Dec 12, 2021
31 tasks
@bors
Copy link
Contributor

bors bot commented Dec 12, 2021

@bors bors bot merged commit db2a708 into rust-lang:master Dec 12, 2021
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.

1 participant