-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Add UTF-8 validation fast paths in Wtf8Buf
#137154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only have one very small nit but otherwise it looks good to me.
library/std/src/sys_common/wtf8.rs
Outdated
if let Some(s) = self.as_known_utf8() { | ||
return fmt::Display::fmt(s, formatter); | ||
} | ||
fmt::Display::fmt(&**self, formatter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just be an if
/else
rather than early return
c5b3cb5
to
eb14652
Compare
Now that #137155 is finally through the merge queue, I've addressed your feedback and rebased onto it to resolve conflicts. |
Ok, looks good! @bors r+ |
@bors rollup because it's small |
Rollup of 14 pull requests Successful merges: - rust-lang#136576 (pass optimization level to llvm-bitcode-linker) - rust-lang#137154 (Add UTF-8 validation fast paths in `Wtf8Buf`) - rust-lang#137311 (Enable `f16` for MIPS) - rust-lang#137320 (fix(rustdoc): Fixed stability version in rustdoc) - rust-lang#137529 (remove few unused args) - rust-lang#137544 (tests: Add regression test for derive token invalidation (rust-lang#81099)) - rust-lang#137559 (run some tests on emscripten again) - rust-lang#137601 (ssa/mono: deduplicate `type_has_metadata`) - rust-lang#137603 (codegen_llvm: avoid `Deref` impls w/ extern type) - rust-lang#137604 (trait_sel: resolve vars in host effects) - rust-lang#137609 (Complete the list of resources used in rustdoc output) - rust-lang#137613 (hir_analysis: skip self type of host effect preds in variances_of) - rust-lang#137614 (fix doc in library/core/src/pin.rs) - rust-lang#137622 (fix attribute-related ICE when parsing macro on the rhs of a name-value attribute) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137154 - thaliaarchi:wtf8-fast-paths, r=ChrisDenton Add UTF-8 validation fast paths in `Wtf8Buf` This adds two more fast paths for UTF-8 validation in `Wtf8Buf`, making use of the `is_known_utf8` flag added in rust-lang#96869 (Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8). r? `@ChrisDenton`
This adds two more fast paths for UTF-8 validation in
Wtf8Buf
, making use of theis_known_utf8
flag added in #96869 (OptimizeWtf8Buf::into_string
for the case where it contains UTF-8).r? @ChrisDenton