Skip to content
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

Unescaping cleanups #118734

Merged
merged 9 commits into from
Dec 9, 2023
Merged

Unescaping cleanups #118734

merged 9 commits into from
Dec 9, 2023

Conversation

nnethercote
Copy link
Contributor

Minor improvements I found while working on #118699.

r? @fee1-dead

Raw strings (of all kinds) don't support escapes, so this function
should never be called on them.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 8, 2023
Copy link
Member

@fee1-dead fee1-dead left a comment

Choose a reason for hiding this comment

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

overall lgtm, had a nit and a comment about the change back to Mode again

compiler/rustc_lexer/src/unescape.rs Outdated Show resolved Hide resolved
compiler/rustc_lexer/src/unescape.rs Outdated Show resolved Hide resolved
compiler/rustc_lexer/src/unescape.rs Show resolved Hide resolved
The fallback `_` case works for these chars, no need to treat them
specially.
These don't really make sense since C string literals were added. This
commit removes them in favour for `mode: Mode` args. `ascii_check` still
has a `characters_should_be_ascii: bool` arg.

Also, `characters_should_be_ascii` is renamed to be shorter.
The `empty!` macro calls should be outside the `cfg(FALSE)` function.
- Add `use Mode::*` to avoid all the qualifiers.
- Reorder the variants. The existing order makes no particular sense,
  which has bugged me for some time. I've chosen an order that makes
  sense to me.
@nnethercote
Copy link
Contributor Author

Thanks for the fast review. I addressed the nits.

@bors r=fee1-dead

@bors
Copy link
Contributor

bors commented Dec 8, 2023

📌 Commit 0a401b6 has been approved by fee1-dead

It is now in the queue for this repository.

@bors bors 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 8, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2023
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#117953 (Add more SIMD platform-intrinsics)
 - rust-lang#118057 (dedup for duplicate suggestions)
 - rust-lang#118638 (More `rustc_mir_dataflow` cleanups)
 - rust-lang#118702 (Strengthen well known check-cfg names and values test)
 - rust-lang#118734 (Unescaping cleanups)
 - rust-lang#118766 (Lower some forgotten spans)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a1c252f into rust-lang:master Dec 9, 2023
11 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 9, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2023
Rollup merge of rust-lang#118734 - nnethercote:literal-cleanups, r=fee1-dead

Unescaping cleanups

Minor improvements I found while working on rust-lang#118699.

r? `@fee1-dead`
@nnethercote nnethercote deleted the literal-cleanups branch December 10, 2023 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants