-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Implement RFC 3349, mixed utf8 literals #120286
base: master
Are you sure you want to change the base?
Conversation
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
This comment has been minimized.
This comment has been minimized.
bc4ce4a
to
f2dee33
Compare
This comment has been minimized.
This comment has been minimized.
8b2b3a7
to
585f313
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
…, r=<try> Implement RFC 3349, mixed utf8 literals RFC: rust-lang/rfcs#3349 Tracking issue: rust-lang#116907 r? `@ghost`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (b626f8d): comparison URL. Overall result: ❌✅ regressions and improvements - 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never 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: 662.082s -> 661.981s (-0.02%) |
No significant perf changes. @rustbot label: +perf-regression-triaged |
This doesn't fully implement the RFC, because I think a couple of things in the RFC are a bad idea. Details in this comment. |
Specifically: - Allow unicode chars in b"" and br"" literals. This is done by changing `Mode::allow_unicode_chars` to succeed on `ByteStr` and `RawByteStr`. - Allow unicode escapes in b"" literals. This is done by changing `Mode::allow_unicode_escapes` to succeed on `ByteStr`. Byte string literals can already have high bytes (`\x80`..`\xff`). Because they now also support unicode chars, they can now be mixed utf8, so we use `unescape_mixed`/`cook_mixed` instead of `unescape_unicode`/`cook_unicode` to process them. A new type `Rfc3349`, is used to implement the feature gating. Values of that type are threaded through the unescaping code to track whether rules from rfc3349 are required for unescaping to succeed. Test changes: - tests/ui/mixed-utf8-literals/basic.rs: new `check-pass` UI test with various literals exercising the new forms. - tests/ui/attributes/key-value-non-ascii.rs: changed from a byte string literal to a byte literal; we just need some kind of problem with a literal to preserve the test's intent. - tests/ui/parser/raw/raw-byte-string-literals.rs: moved the raw byte string literal with a non-ASCII char to `basic.rs`. - tests/ui/parser/byte-string-literals.rs: similar. - tests/ui/parser/issues/issue-23620-invalid-escapes.rs: moved one case fully to `basic.rs`, and one partially. - tests/ui/parser/unicode-control-codepoints.rs: left the code unchanged, but the errors are now about mixed-utf8-literals being feature gated. - tests/ui/suggestions/multibyte-escapes.rs: moved one case to `basic.rs`. - compiler/rustc_lexer/src/unescape/tests.rs: various adjustments - two cases that previously failed now succeed - added some more cases for the newly supported syntax I wasn't sure how to handle rust-analyzer in general, so I just allowed mixed utf8 literals everywhere without complaint.
585f313
to
c144da3
Compare
☔ The latest upstream changes (presumably #120491) made this pull request unmergeable. Please resolve the merge conflicts. |
@nnethercote any updates on this? thanks |
I nominated it for lang-team discussion six months ago, and haven't heard anything since. |
I'll signal that this needs to be discussed by T-lang @rustbot label +S-blocked |
RFC: rust-lang/rfcs#3349
Tracking issue: #116907
r? @ghost