about summary refs log tree commit diff
path: root/library/std/src/sys/os_str/bytes.rs
AgeCommit message (Collapse)AuthorLines
2025-05-24make `OsString::new` and `PathBuf::new` unstably constcyrgani-1/+1
2025-04-30Make internal `OsString::truncate` and `extend_from_slice` unsafeThalia Archibald-9/+16
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-16Synchronize platform adaptors for OsString/OsStrThalia Archibald-36/+50
* 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-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-3/+1
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-06-25`PathBuf::as_mut_vec` removed and verified for UEFI and Windows platforms ↵ash-5/+10
#126333
2024-06-25inner truncate methods for UEFI platformsash-0/+5
2024-06-04impl OsString::leak & PathBuf::leakschvv31n-0/+5
2024-04-26Rollup merge of #124410 - RalfJung:path-buf-transmute, r=NilstriebJacob Pratt-0/+6
PathBuf: replace transmuting by accessor functions The existing `repr(transparent)` was anyway insufficient as `OsString` was not `repr(transparent)`. And furthermore, on Windows it was blatantly wrong as `OsString` wraps `Wtf8Buf` which is a `repr(Rust)` type with 2 fields: https://github.com/rust-lang/rust/blob/51a7396ad3d78d9326ee1537b9ff29ab3919556f/library/std/src/sys_common/wtf8.rs#L131-L146 So let's just be honest about what happens and add accessor methods that make this abstraction-breaking act of PathBuf visible on the APIs that it pierces through. Fixes https://github.com/rust-lang/rust/issues/124409
2024-04-26PathBuf: replace transmuting by accessor functionsRalf Jung-0/+6
2024-04-24Stabilize Utf8ChunksDavid Tolnay-4/+2
2024-01-21Move `OsStr::slice_encoded_bytes` validation to platform modulesJan Verbeek-0/+43
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/+287