about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2023-07-14Re-export core::ffi::FromBytesUntilNulError in std::ffiAllen Wild-0/+2
Like the other CStr and CString error types, make a re-export for std::ffi::FromBytesUntilNulError. This seems to have slipped through the cracks in the cstr_from_bytes_until_nul implementation and core_c_str migration. Tracking Issue: #95027
2023-07-14Rollup merge of #113618 - tshepang:patch-1, r=jyn514Matthias Krüger-2/+2
update ancient note
2023-07-14Rollup merge of #112525 - hermitcore:devel, r=m-ou-seMatthias Krüger-4/+3
Adjustments for RustyHermit The interface between `libstd` and the OS changed and some changes are not correctly merged for RustHermit. For instance, the crate `hermit_abi` isn't defined as public, although it provided the socket interface for the application. In addition, the support of thread::available_parallelism is realized. It returns the number of available processors.
2023-07-12Replace version placeholder to 1.72Mark Rousskov-2/+2
2023-07-12avoid ambiguous wordTshepang Mbambo-1/+1
See https://github.com/rust-lang/rust/pull/113618#pullrequestreview-1526295432
2023-07-12fix usage of Timespec om the target hermitStefan Lankes-2/+2
2023-07-12add support of available_parallelism for target hermitStefan Lankes-2/+1
On RustyHermit, the function `get_processor_count` returns the number of activated processors.
2023-07-12update ancient noteTshepang Mbambo-2/+2
2023-07-11Auto merge of #103754 - SUPERCILEX:filled-mut, r=m-ou-sebors-0/+7
Add back BorrowedBuf::filled_mut This is useful if you want to do some processing on the bytes while still using the BorrowedBuf. The API was removed in https://github.com/rust-lang/rust/pull/97015 with no explanation. The RFC also has it as part of its API, so this just seems like a mistake: [RFC](https://rust-lang.github.io/rfcs/2930-read-buf.html#:~:text=inline%5D%0A%20%20%20%20pub%20fn-,filled_mut,-(%26mut%20self)) ACP: https://github.com/rust-lang/libs-team/issues/139
2023-07-10Correct the Android stat struct definitionsChris Wailes-47/+58
See https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/stat.h for reference.
2023-07-10Auto merge of #94748 - tbu-:pr_file_arc, r=Amanieubors-32/+65
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC #53835. CC #94744.
2023-07-10Auto merge of #108796 - devsnek:personality-pal-exception, r=workingjubileebors-1/+1
move personality to sys this moves `personality` to sys, removing another PAL exception
2023-07-09move personality to sysGus Caplan-1/+1
2023-07-10Auto merge of #108485 - devsnek:float-pat-exception, r=workingjubileebors-36/+53
move pal cfgs in f32 and f64 to sys I'd like to push forward on `sys` being a separate crate. To start with, most of these PAL exception cases are very simple little bits of code like this, so I thought I would try tidying them up.
2023-07-09move pal cfgs in f32 and f64 to sysGus Caplan-36/+53
2023-07-09additional io::copy specializationsThe 8472-3/+116
- copying from `&[u8]` and `VecDeque<u8>` - copying to `Vec<u8>`
2023-07-07Allow limited access to `OsString` bytesEd Page-0/+100
This extends #109698 to allow no-cost conversion between `Vec<u8>` and `OsString` as suggested in feedback from `os_str_bytes` crate in #111544.
2023-07-06Rollup merge of #112008 - intruder-kat:master, r=NilstriebMichael Goulet-2/+2
Fix incorrect documented default bufsize in bufreader/writer
2023-07-06Rollup merge of #113334 - fmease:revert-lexing-c-str-lits, r=compiler-errorsfee1-dead-26/+26
Revert the lexing of `c"…"` string literals Fixes \[after beta-backport\] #113235. Further progress is tracked in #113333. This PR *manually* reverts parts of #108801 (since a git-revert would've been too coarse-grained & messy) and git-reverts #111647. CC `@fee1-dead` (#108801) `@klensy` (#111647) r? `@compiler-errors` `@rustbot` label F-c_str_literals beta-nominated
2023-07-05Revert "use c literals in library"León Orell Valerian Liehr-23/+25
This reverts commit f212ba6d6d60963c8101bb24fc3e53fca80c046f.
2023-07-05Revert "fix ptr cast"León Orell Valerian Liehr-9/+7
This reverts commit 2f459f7f140307b5abbb7ea81440ed1843b490e7.
2023-07-05Auto merge of #112594 - ChrisDenton:process=-kill, r=Amanieubors-14/+32
Return `Ok` on kill if process has already exited This will require an FCP from `@rust-lang/libs-api.` Fixes #112423. See that issue for more details.
2023-07-05Workaround for old android not having echoChris Denton-1/+8
2023-07-04Test Child::kill behaviour on exited processChris Denton-0/+8
2023-07-02Rollup merge of #113202 - guilliamxavier:patch-1, r=workingjubileeMatthias Krüger-6/+8
std docs: factorize literal in Barrier example Motivated by https://www.reddit.com/r/rust/comments/rnh5hu/barrier_question_barrier_does_not_sync_many/ (but maybe not worth it?)
2023-07-01Return `Ok` on kill if process has already exitedChris Denton-14/+17
2023-06-30std docs: factorize literal in Barrier exampleGuilliam Xavier-6/+8
2023-06-29make HashMap::or_insert_with example more simpleTshepang Mbambo-4/+4
2023-06-27std: remove an allocation in `Path::with_extension`João M. Bezerra-3/+21
`Path::with_extension` used to reallocate (and copy) paths twice per call, now it does it once, by checking the size of the previous and new extensions it's possible to call `PathBuf::with_capacity` and pass the exact capacity it takes. Also reduce the memory consumption of the path returned from `Path::with_extension` by using exact capacity instead of using amortized exponential growth.
2023-06-25Stabilize chown functions (`unix_chown`)Yuki Okushi-6/+3
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-06-25Auto merge of #113001 - ChrisDenton:win-arm32-shim, r=thomccbors-49/+44
Move windows-sys arm32 shim to c.rs This moves the arm32 shim in to c.rs instead of appending to the generated file itself. This makes it simpler to change these workarounds if/when needed. The downside is we need to exclude a couple of functions from being generated (see the comment). A metadata solution could help here but they'll be easy enough to add back if that happens.
2023-06-25Rollup merge of #113009 - ChrisDenton:remove-path, r=workingjubileeMatthias Krüger-1/+0
Remove unnecessary `path` attribute Follow up to #111401. I missed this at the time but it should now be totally unnecessary since the other include was removed. r? `@workingjubilee`
2023-06-25Rollup merge of #112950 - tshepang:patch-4, r=Mark-SimulacrumMatthias Krüger-2/+8
DirEntry::file_name: improve explanation
2023-06-24Remove unnecessary `path` attributeChris Denton-1/+0
2023-06-24Move arm32 shim to c.rsChris Denton-49/+44
2023-06-23Rollup merge of #111087 - ibraheemdev:patch-15, r=dtolnayMichael Goulet-2/+2
Implement `Sync` for `mpsc::Sender` `mpsc::Sender` is currently `!Sync` because the previous implementation contained an optimization where the channel started out as single-producer and was dynamically upgraded on the first clone, which relied on a unique reference to the sender. This optimization is one of the main reasons the old implementation was so complex and was removed in #93563. `mpsc::Sender` can now soundly implement `Sync`. Note for any potential confusion, this chance does *not* add MPMC behavior. This only affects the already `Send + Clone` *sender*, not *receiver*. It's technically possible to rely on the `!Sync` behavior in the same way as a `PhantomData<*mut T>`, but that seems very unlikely in practice. Either way, this change is insta-stable and needs an FCP. `@rustbot` label +T-libs-api -T-libs
2023-06-23Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriateTobias Bucher-0/+46
If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC #53835. CC #94744.
2023-06-23Forward `io::{Read,Seek,Write}` impls of `File` to `&File`Tobias Bucher-33/+20
This reduces code duplication.
2023-06-23DirEntry::file_name: improve explanationTshepang Mbambo-2/+8
2023-06-21Actually save all the filesThom Chiovoloni-7/+6
2023-06-21Update tvOS support elsewhere in the stdlibThom Chiovoloni-7/+36
2023-06-21Avoid fork/exec spawning on tvOS/watchOS, as those functions are marked as ↵Thom Chiovoloni-4/+48
prohibited
2023-06-21Finish up preliminary tvos support in libstdThom Chiovoloni-1/+15
2023-06-21wip: Support Apple tvOS in libstdThom Chiovoloni-20/+82
2023-06-21Rollup merge of #112863 - clubby789:stderr-typo, r=albertlarsan68Guillaume Gomez-2/+2
Fix copy-paste typo in `eprint(ln)` docs Fixes #112862
2023-06-21Rollup merge of #99587 - ibraheemdev:park-orderings, r=m-ou-seGuillaume Gomez-11/+21
Document memory orderings of `thread::{park, unpark}` Document `thread::park/unpark` as having acquire/release synchronization. Without that guarantee, even the example in the documentation can deadlock: ```rust let flag = Arc::new(AtomicBool::new(false)); let t2 = thread::spawn(move || { while !flag.load(Ordering::Acquire) { thread::park(); } }); flag.store(true, Ordering::Release); t2.thread().unpark(); // t1: flag.store(true) // t1: thread.unpark() // t2: flag.load() == false // t2 now parks, is immediately unblocked but never // acquires the flag, and thus spins forever ``` Multiple calls to `unpark` should also maintain a release sequence to make sure operations released by previous `unpark`s are not lost: ```rust let a = Arc::new(AtomicBool::new(false)); let b = Arc::new(AtomicBool::new(false)); let t2 = thread::spawn(move || { while !a.load(Ordering::Acquire) || !b.load(Ordering::Acquire) { thread::park(); } }); thread::spawn(move || { a.store(true, Ordering::Release); t2.thread().unpark(); }); b.store(true, Ordering::Release); t2.thread().unpark(); // t1: a.store(true) // t1: t2.unpark() // t3: b.store(true) // t3: t2.unpark() // t2 now parks, is immediately unblocked but never // acquires the store of `a`, only the store of `b` which // was released by the most recent unpark, and thus spins forever ``` This is of course a contrived example, but is reasonable to rely upon in real code. Note that all implementations of park/unpark already comply with the rules, it's just undocumented.
2023-06-21"Memory Orderings" -> "Memory Ordering"Mara Bos-1/+1
Co-authored-by: yvt <i@yvt.jp>
2023-06-21Fix typo in `eprintln` docsclubby789-2/+2
2023-06-20relaxed orderings in `thread::park` exampleIbraheem Ahmed-3/+4
2023-06-20Rollup merge of #112464 - eval-exec:exec/fix-connect_timeout-overflow, ↵Guillaume Gomez-1/+12
r=ChrisDenton Fix windows `Socket::connect_timeout` overflow This PR want to close #112405 - [x] add unit test