-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove token::{Open,Close}Delim
#139897
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
Remove token::{Open,Close}Delim
#139897
Conversation
This comment has been minimized.
This comment has been minimized.
f6f6a74
to
8318b85
Compare
This comment has been minimized.
This comment has been minimized.
8318b85
to
16cfe17
Compare
This comment has been minimized.
This comment has been minimized.
16cfe17
to
d6622d6
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
… r=<try> Remove `token::{Open,Close}Delim` r? `@ghost`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (448bb73): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.4%)This 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.
CyclesResults (primary -0.6%)This 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 776.859s -> 775.51s (-0.17%) |
d6622d6
to
d507b13
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Slight perf wins too, that's nice. |
Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Some changes occurred in compiler/rustc_attr_parsing |
Reminder, once the PR becomes ready for a review, use |
d507b13
to
642cfba
Compare
I added two new commits.
|
@rustbot ready |
Can you drop the |
642cfba
to
a35c855
Compare
Done. |
r=me after squashing commits. |
By replacing them with `{Open,Close}{Param,Brace,Bracket,Invisible}`. PR rust-lang#137902 made `ast::TokenKind` more like `lexer::TokenKind` by replacing the compound `BinOp{,Eq}(BinOpToken)` variants with fieldless variants `Plus`, `Minus`, `Star`, etc. This commit does a similar thing with delimiters. It also makes `ast::TokenKind` more similar to `parser::TokenType`. This requires a few new methods: - `TokenKind::is_{,open_,close_}delim()` replace various kinds of pattern matches. - `Delimiter::as_{open,close}_token_kind` are used to convert `Delimiter` values to `TokenKind`. Despite these additions, it's a net reduction in lines of code. This is because e.g. `token::OpenParen` is so much shorter than `token::OpenDelim(Delimiter::Parenthesis)` that many multi-line forms reduce to single line forms. And many places where the number of lines doesn't change are still easier to read, just because the names are shorter, e.g.: ``` - } else if self.token != token::CloseDelim(Delimiter::Brace) { + } else if self.token != token::CloseBrace { ```
a35c855
to
bf8ce32
Compare
I squashed the commits. @bors r=petrochenkov |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing d6c1e45 (parent) -> fae7785 (this PR) Test differencesShow 20 test diffs20 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard fae7785b60ea7fe1ad293352c057a5b7be73d245 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (fae7785): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 0.3%, secondary 3.4%)This 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.
CyclesResults (primary -0.6%, secondary 1.8%)This 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 774.01s -> 775.257s (0.16%) |
By replacing them with
{Open,Close}{Param,Brace,Bracket,Invisible}
.PR #137902 made
ast::TokenKind
more likelexer::TokenKind
byreplacing the compound
BinOp{,Eq}(BinOpToken)
variants with fieldlessvariants
Plus
,Minus
,Star
, etc. This commit does a similar thingwith delimiters. It also makes
ast::TokenKind
more similar toparser::TokenType
.This requires a few new methods:
TokenKind::is_{,open_,close_}delim()
replace various kinds ofpattern matches.
Delimiter::as_{open,close}_token_kind
are used to convertDelimiter
values toTokenKind
.Despite these additions, it's a net reduction in lines of code. This is
because e.g.
token::OpenParen
is so much shorter thantoken::OpenDelim(Delimiter::Parenthesis)
that many multi-line formsreduce to single line forms. And many places where the number of lines
doesn't change are still easier to read, just because the names are
shorter, e.g.:
r? @petrochenkov