rust/library
bors 25ea5a36c6 Auto merge of #96869 - sunfishcode:main, r=joshtriplett
Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8.

Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the
string is known to contain UTF-8. This is efficiently computed in many
common situations, such as when a `Wtf8Buf` is constructed from a `String`
or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16
decoding and already checking for surrogates.

This makes `OsString::into_string` O(1) rather than O(N) on Windows in
common cases.

And, it eliminates the need to scan through the string for surrogates in
`Args::next` and `Vars::next`, because the strings are already being
translated with `Wtf8Buf::from_wide`.

Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`,
such as `DirEntry::file_name` and `fs::read_link`, so with this patch,
users of those functions can subsequently call `.into_string()` without
paying for an extra scan through the string for surrogates.

r? `@ghost`
2022-08-24 01:17:52 +00:00
..
alloc Auto merge of #99917 - yaahc:error-in-core-move, r=thomcc 2022-08-23 19:48:55 +00:00
backtrace@4e5a3f7292 update libbacktrace 2022-05-20 09:30:26 +02:00
core Auto merge of #99917 - yaahc:error-in-core-move, r=thomcc 2022-08-23 19:48:55 +00:00
panic_abort Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
panic_unwind Replace most uses of pointer::offset with add and sub 2022-08-21 02:21:41 +04:00
portable-simd Sync core::simd up to rust-lang/portable-simd@2e081db92a 2022-07-20 17:57:56 -07:00
proc_macro proc_macro: use crossbeam channels for the proc_macro cross-thread bridge 2022-07-29 17:38:12 -04:00
profiler_builtins Fully stabilize NLL 2022-06-03 17:16:41 -04:00
rtstartup
rustc-std-workspace-alloc Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
rustc-std-workspace-core Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
rustc-std-workspace-std Switch all libraries to the 2021 edition 2021-12-23 19:03:47 +08:00
std Auto merge of #96869 - sunfishcode:main, r=joshtriplett 2022-08-24 01:17:52 +00:00
stdarch@28335054b1 Also allow unused macro rules in stdarch 2022-05-10 19:53:22 +02:00
test test: skip terminfo parsing in Miri 2022-08-07 11:56:12 -04:00
unwind unwind: don't build dependency when building for Miri 2022-08-15 12:54:12 -04:00