Skip to content

Literal error reporting cleanup - #72047

Merged
bors merged 4 commits into
rust-lang:masterfrom
Julian-Wollersberger:literal_error_reporting_cleanup
May 16, 2020
Merged

Literal error reporting cleanup#72047
bors merged 4 commits into
rust-lang:masterfrom
Julian-Wollersberger:literal_error_reporting_cleanup

Conversation

@Julian-Wollersberger

Copy link
Copy Markdown
Contributor

While doing some performance work, I noticed some code duplication in librustc_parser/lexer/mod.rs, so I cleaned it up.

This PR is probably best reviewed commit by commit.

I'm not sure what the API stability practices for librustc_lexer are. Four public methods in unescape.rs can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.

But how do I open a PR for clippy? (Git submodules are frustrating to work with)

The phrasing is from the commit description of 395ee0b by @matklad.
@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 9, 2020
@petrochenkov

Copy link
Copy Markdown
Contributor

r? @petrochenkov
cc @matklad

@petrochenkov

Copy link
Copy Markdown
Contributor

But how do I open a PR for clippy? (Git submodules are frustrating to work with)

clippy is currently using a subtree rather than a submodule, so it can be fixed right in this repo.

@Julian-Wollersberger

Copy link
Copy Markdown
ContributorAuthor

Thanks. It didn't work with CLion, but it did with command line git.

@rust-highfive

This comment has been minimized.

@petrochenkov

Copy link
Copy Markdown
Contributor
./x.py test --stage 0 src/librustc_lexer

to quickly run the unit tests that are currently failing on CI.

Comment threadsrc/librustc_parse/lexer/mod.rs Outdated
Comment threadsrc/librustc_parse/lexer/mod.rs Outdated
@petrochenkov

Copy link
Copy Markdown
Contributor

LGTM.
(The unescape_* commits could use some squashing.)

@petrochenkovpetrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 10, 2020
@Julian-Wollersberger
Julian-Wollersbergerforce-pushed the literal_error_reporting_cleanup branch from 85856ae to 8abd741CompareMay 12, 2020 11:08
@Julian-Wollersberger

Copy link
Copy Markdown
ContributorAuthor

Addressed the feedback (and remembered to do x.py fmt and test tidy this time).
Thanks for reviewing.

@petrochenkov

Copy link
Copy Markdown
Contributor

See #72047 (comment), but I'll r+ in a couple of days anyway because that's not super critical.

…ods into one method `unescape_literal` with a mode argument.
…o one method `validate_literal_escape` with a mode argument.
This enables simplifying the `match` in `cook_lexer_literal()`
and it eliminates 90 lines of repetition :)
@Julian-Wollersberger
Julian-Wollersbergerforce-pushed the literal_error_reporting_cleanup branch from 8abd741 to 43ae785CompareMay 13, 2020 08:08
@Julian-Wollersberger

Copy link
Copy Markdown
ContributorAuthor

Cleaned up the git history and the code for Int and Float isn't moved around anymore.

@petrochenkov

Copy link
Copy Markdown
Contributor

Thanks!
@bors r+

@bors

bors commented May 13, 2020

Copy link
Copy Markdown
Collaborator

📌 Commit 43ae785 has been approved by petrochenkov

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 13, 2020
RalfJung added a commit to RalfJung/rust that referenced this pull request May 15, 2020
…reporting_cleanup, r=petrochenkov
Literal error reporting cleanup
While doing some performance work, I noticed some code duplication in `librustc_parser/lexer/mod.rs`, so I cleaned it up.
This PR is probably best reviewed commit by commit.
I'm not sure what the API stability practices for `librustc_lexer` are. Four public methods in `unescape.rs` can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.
But how do I open a PR for clippy? (Git submodules are frustrating to work with)
@RalfJungRalfJung mentioned this pull request May 15, 2020
@RalfJungRalfJung mentioned this pull request May 16, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request May 16, 2020
Rollup of 5 pull requests
Successful merges:
- rust-lang#72045 (Incomplete features can also be unsound)
- rust-lang#72047 (Literal error reporting cleanup)
- rust-lang#72060 (move `ty::List` into a new submodule)
- rust-lang#72094 (cmdline: Make target features individually overridable)
- rust-lang#72254 (Remove redundant backtick in error message.)
Failed merges:
r? @ghost
@bors
bors merged commit ec5610f into rust-lang:masterMay 16, 2020
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 17, 2020
…reporting_cleanup, r=petrochenkov
Literal error reporting cleanup
While doing some performance work, I noticed some code duplication in `librustc_parser/lexer/mod.rs`, so I cleaned it up.
This PR is probably best reviewed commit by commit.
I'm not sure what the API stability practices for `librustc_lexer` are. Four public methods in `unescape.rs` can be removed, but two are used by clippy, so I left them in for now.
I could open a PR for Rust-Analyzer when this one lands.
But how do I open a PR for clippy? (Git submodules are frustrating to work with)
borsBot added a commit to rust-lang/rust-analyzer that referenced this pull request May 24, 2020
4590: Update to rustc_lexer version 660 r=matklad a=Julian-Wollersberger
Change the `unescape_*()` functions to `unescape_literal()`, to address the canges I made in rust-lang/rust#72047.
I also noticed some outdated FIXMEs.
Co-authored-by: Julian Wollersberger <24991778+Julian-Wollersberger@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: 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

@Julian-Wollersberger@rust-highfive@petrochenkov@bors@eddyb