about summary refs log tree commit diff
path: root/library/std/src/sys/os_str/wtf8.rs
AgeCommit message (Collapse)AuthorLines
2025-08-20Move WTF-8 code from std to core/allocltdk-3/+5
2025-06-04Rollup merge of #141467 - cyrgani:const-empty-stringlikes, r=AmanieuMatthias Krüger-1/+1
make `OsString::new` and `PathBuf::new` unstably const Since #129041, `String::into_bytes` is `const`, which allows making `OsString::new` and `PathBuf::new` unstably const now. Not sure what the exact process for this is; does it need an ACP?
2025-05-24make `OsString::new` and `PathBuf::new` unstably constcyrgani-1/+1
2025-05-15Fix confusing WTF surrogate safety docsteor-3/+3
2025-04-30Make internal `OsString::truncate` and `extend_from_slice` unsafeThalia Archibald-9/+21
Communicate the safety invariants of these methods with `unsafe fn` rather than privacy.
2025-02-28Specialize OsString::push for stringsThalia Archibald-0/+5
When concatenating two WTF-8 strings, surrogate pairs at the boundaries need to be joined. However, since UTF-8 strings cannot contain surrogate halves, this check can be skipped when one string is UTF-8. Specialize `OsString::push` to use a more efficient concatenation in this case. Unfortunately, a specialization for `T: AsRef<str>` conflicts with `T: AsRef<OsStr>`, so stamp out string types with a macro.
2025-02-19Add fast path for displaying pre-validated Wtf8BufThalia Archibald-2/+2
2025-02-16Synchronize platform adaptors for OsString/OsStrThalia Archibald-38/+69
* Order items as the average of the two adaptors. Enables easier diffs. * Consistently apply #[inline]. * Implement FromInner<Vec<u8>> for bytes::Buf. * Implement Clone::clone_from for wtf8::Buf.
2024-11-12Make `CloneToUninit` dyn-compatibleZachary S-3/+3
2024-09-25Use `&raw` in the standard libraryJosh Stone-2/+1
Since the stabilization in #127679 has reached stage0, 1.82-beta, we can start using `&raw` freely, and even the soft-deprecated `ptr::addr_of!` and `ptr::addr_of_mut!` can stop allowing the unstable feature. I intentionally did not change any documentation or tests, but the rest of those macro uses are all now using `&raw const` or `&raw mut` in the standard library.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Sparkle some attributes over `CloneToUninit` stuffPavel Grigorenko-0/+1
2024-07-29impl CloneToUninit for Path and OsStrPavel Grigorenko-0/+12
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-17forbid(unsafe_op_in_unsafe_fn) in sys/os_strChris Denton-2/+0
2024-07-15Deny more windows unsafe_op_in_unsafe_fnChris Denton-2/+3
2024-06-25`PathBuf::as_mut_vec` removed and verified for UEFI and Windows platforms ↵ash-3/+13
#126333
2024-06-20Convert some module-level `//` and `///` comments to `//!`.Nicholas Nethercote-2/+3
This makes their intent and expected location clearer. We see some examples where these comments were not clearly separate from `use` declarations, which made it hard to understand what the comment is describing.
2024-06-04impl OsString::leak & PathBuf::leakschvv31n-0/+5
2024-04-26PathBuf: replace transmuting by accessor functionsRalf Jung-0/+6
2024-01-21Move `OsStr::slice_encoded_bytes` validation to platform modulesJan Verbeek-1/+6
On Windows and UEFI this improves performance and error messaging. On other platforms we optimize the fast path a bit more. This also prepares for later relaxing the checks on certain platforms.
2024-01-15std: move OS String implementation into `sys`joboet-0/+245