Uh oh!
There was an error while loading. Please reload this page.
Some parser and AST cleanups - #114353
Conversation
It has a single call site.
This code currently uses a `while` loop and gathers token trees into a vector, but it only succeeds in the case where there is a single token tree. We can instead just call `parse_token_tree` once and then look for `Eof` to detect the success case.
It's more of a `Parser`-level concern than a `TokenCursor`-level concern. Also, `num_bump_calls` is a more accurate name, because it's incremented in `Parser::bump`.
Similar to the last commit, it's more of a `Parser`-level concern than a `TokenCursor`-level concern. And the struct size reductions are nice. After this change, `TokenCursor` is as minimal as possible (two fields and two methods) which is nice.
The `None` variant has already been renamed `Invisible`.
rustbot
commented
Aug 2, 2023
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Aug 2, 2023
r=me after addressing #114353 (comment) and fixing doc comments. |
69f8ece to
60231d6Comparennethercote
commented
Aug 2, 2023
Thank you for the fast review. I addressed the review comments and fixed the doc comments. @bors r=petrochenkov rollup |
bors
commented
Aug 2, 2023
This comment has been minimized.
This comment has been minimized.
…=petrochenkov Some parser and AST cleanups Things I found while looking closely at this code. r? `@petrochenkov`
Noratrieb
commented
Aug 2, 2023
@bors r- CI failure |
It's the same as `Delimiter`, minus the `Invisible` variant. I'm generally in favour of using types to make impossible states unrepresentable, but this one feels very low-value, and the conversions between the two types are annoying and confusing. Look at the change in `src/tools/rustfmt/src/expr.rs` for an example: the old code converted from `MacDelimiter` to `Delimiter` and back again, for no good reason. This suggests the author was confused about the types.
60231d6 to
d75ee2aComparennethercote
commented
Aug 2, 2023
I fixed the rustfmt formatting error. @bors r=petrochenkov |
bors
commented
Aug 2, 2023
bors
commented
Aug 3, 2023
bors
commented
Aug 3, 2023
☀️ Test successful - checks-actions |
rust-timer
commented
Aug 3, 2023
Finished benchmarking commit (fb31b3c): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 650.497s -> 647.579s (-0.45%) |
Things I found while looking closely at this code.
r? @petrochenkov