about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2024-04-01Rollup merge of #123323 - devnexen:thread_set_name_solaris_fix, r=workingjubileeJubilee-1/+6
std::thread: set_name change for solaris/illumos. truncate down to 32 (31 + 1) for solaris/illumos.
2024-04-01std::thread: set_name change for solaris/illumos.David Carlier-1/+6
truncate down to 32 (31 + 1) for solaris/illumos.
2024-04-01Auto merge of #123315 - devnexen:thread_get_name_solaris, r=ChrisDentonbors-3/+11
std::thread: adding get_name implementation for solaris/illumos. THREAD_NAME_MAX is 32 (31 max + 1 for the null terminator).
2024-04-01Auto merge of #123265 - joboet:guardians_of_the_unix, r=ChrisDentonbors-490/+317
Refactor stack overflow handling Currently, every platform must implement a `Guard` that protects a thread from stack overflow. However, UNIX is the only platform that actually does so. Windows has a different mechanism for detecting stack overflow, while the other platforms don't detect it at all. Also, the UNIX stack overflow handling is split between `sys::pal::unix::stack_overflow`, which implements the signal handler, and `sys::pal::unix::thread`, which detects/installs guard pages. This PR cleans this by getting rid of `Guard` and unifying UNIX stack overflow handling inside `stack_overflow` (commit 1). Therefore we can get rid of `sys_common::thread_info`, which stores `Guard` and the current `Thread` handle and move the `thread::current` TLS variable into `thread` (commit 2). The second commit is not strictly speaking necessary. To keep the implementation clean, I've included it here, but if it causes too much noise, I can split it out without any trouble.
2024-04-01update commentjoboet-4/+1
2024-04-01std::thread: adding get_name implementation for solaris/illumos.David Carlier-3/+11
THREAD_NAME_MAX is 32 (31 max + 1 for the null terminator).
2024-03-31Auto merge of #123299 - workingjubilee:rollup-2z8amaj, r=workingjubileebors-1/+19
Rollup of 5 pull requests Successful merges: - #123180 (Rewrite `core-no-fp-fmt-parse` test in Rust) - #123267 (std::thread: adding get_name haiku implementation.) - #123268 (warn against implementing Freeze) - #123271 (doc: describe panic conditions for SliceIndex implementations) - #123295 (add myself to compiler review rotation) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-31std::thread: adding get_name haiku implementation.David Carlier-1/+19
follow-up #123233
2024-03-31catch_panic: warn about panicking payload dropRalf Jung-0/+3
2024-03-31std: move `thread::current` TLS variable out of `thread_info`joboet-176/+29
2024-03-31std: move UNIX stack overflow guard page handling into `stack_overflow.rs`joboet-310/+287
2024-03-30std::thread: adding freebsd/netbsd to the linux's get_name implementation.David Carlier-1/+8
2024-03-29stabilize ptr.is_aligned, move ptr.is_aligned_to to a new feature gateAria Beingessner-1/+1
This is an alternative to #121920
2024-03-29Auto merge of #122975 - DianQK:simplify_ub_check, r=saethlinbors-0/+1
Eliminate `UbChecks` for non-standard libraries The purpose of this PR is to allow other passes to treat `UbChecks` as constants in MIR for optimization after #122629. r? RalfJung
2024-03-27Some wording improvementVagelis Prokopiou-2/+2
2024-03-27Eliminate `UbCheck` for non-standard librariesDianQK-0/+1
2024-03-27Auto merge of #123128 - GuillaumeGomez:rollup-3l3zu6s, r=GuillaumeGomezbors-2/+2
Rollup of 6 pull requests Successful merges: - #121843 (Implement `-L KIND=`@RUSTC_BUILTIN/...`)` - #122860 (coverage: Re-enable `UnreachablePropagation` for coverage builds) - #123021 (Make `TyCtxt::coroutine_layout` take coroutine's kind parameter) - #123024 (CFI: Enable KCFI testing of run-pass tests) - #123083 (lib: fix some unnecessary_cast clippy lint) - #123116 (rustdoc: Swap fields and variant documentations) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-27Rollup merge of #123083 - klensy:clippy-me, r=workingjubileeGuillaume Gomez-2/+2
lib: fix some unnecessary_cast clippy lint Fixes few instances of `unnecessary_cast` clippy lint
2024-03-27impl get_mut_or_init and get_mut_or_try_init for OnceCell and OnceLocktison-0/+81
See also https://github.com/rust-lang/rust/issues/74465#issuecomment-1676522051 Signed-off-by: tison <wander4096@gmail.com>
2024-03-27Auto merge of #116016 - jhpratt:kill-rustc-serialize, r=ehussbors-12/+23
Soft-destabilize `RustcEncodable` & `RustcDecodable`, remove from prelude in next edition cc rust-lang/libs-team#272 Any use of `RustcEncodable` and `RustcDecodable` now triggers a deny-by-default lint. The derives have been removed from the 2024 prelude. I specifically chose **not** to document this in the module-level documentation, as the presence in existing preludes is not documented (which I presume is intentional). This does not implement the proposed change for `rustfix`, which I will be looking into shortly. With regard to the items in the preludes being stable, this should not be an issue because #15702 has been resolved. r? libs-api
2024-03-27Rollup merge of #123118 - tgross35:rwlock-docs, r=workingjubileeMatthias Krüger-6/+7
Update `RwLock` deadlock example to not use shadowing Tweak variable names in the deadlock example to remove any potential confusion that the behavior is somehow shadowing-related.
2024-03-27Rollup merge of #123084 - a1phyr:unixstream_read_buf, r=workingjubileeMatthias Krüger-0/+8
`UnixStream`: override `read_buf` Split from #122441 r? ``@workingjubilee``
2024-03-27Rollup merge of #123038 - he32:netbsd-ilp32-fix, r=workingjubileeMatthias Krüger-1/+1
std library thread.rs: fix NetBSD code for ILP32 CPUs.
2024-03-27Rollup merge of #122880 - a1phyr:preadv_more_platform, r=workingjubileeMatthias Krüger-6/+22
Unix: Support more platforms with `preadv` and `pwritev` - `aix`, `dragonfly` and `openbsd` with direct call - `watchos` with weak linkage cc #89517
2024-03-26Update `RwLock` deadlock example to not use shadowingTrevor Gross-6/+7
Tweak variable names in the deadlock example to remove any potential confusion that the behavior is somehow shadowing-related.
2024-03-26Rollup merge of #123057 - sthibaul:systemtime, r=jhprattMatthias Krüger-2/+2
unix fs: Make hurd using explicit new rather than From 408c0ea2162b ("unix time module now return result") dropped the From impl for SystemTime, breaking the hurd build (and probably the horizon build) Fixes #123032
2024-03-26unix fs: Make hurd and horizon using explicit new rather than FromSamuel Thibault-2/+2
408c0ea2162b ("unix time module now return result") dropped the From impl for SystemTime, breaking the hurd and horizon builds. Fixes #123032
2024-03-26Unix: Support more platforms with `preadv` and `pwritev`Benoît du Garreau-6/+22
2024-03-26`UnixStream`: override `read_buf`Benoît du Garreau-0/+8
2024-03-26Fix link to BufWriterding-young-1/+1
2024-03-26std library unix/thread.rs: fix NetBSD code for ILP32 CPUs.Havard Eidnes-1/+1
2024-03-25lib: fix some unnecessary_cast clippy lintklensy-2/+2
warning: casting raw pointers to the same type and constness is unnecessary (`*mut V` -> `*mut V`) --> library\alloc\src\collections\btree\map\entry.rs:357:31 | 357 | let val_ptr = root.borrow_mut().push(self.key, value) as *mut V; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `root.borrow_mut().push (self.key, value)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting to the same type is unnecessary (`usize` -> `usize`) --> library\alloc\src\ffi\c_str.rs:411:56 | 411 | let slice = slice::from_raw_parts_mut(ptr, len as usize); | ^^^^^^^^^^^^ help: try: `len` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*mut T` -> `*mut T`) --> library\alloc\src\slice.rs:516:25 | 516 | (buf.as_mut_ptr() as *mut T).add(buf.len()), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `buf.as_mut_ptr()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*mut T` -> `*mut T`) --> library\alloc\src\slice.rs:537:21 | 537 | (buf.as_mut_ptr() as *mut T).add(buf.len()), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `buf.as_mut_ptr()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*const ()` -> `*const ()`) --> library\alloc\src\task.rs:151:13 | 151 | waker as *const (), | ^^^^^^^^^^^^^^^^^^ help: try: `waker` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting raw pointers to the same type and constness is unnecessary (`*const ()` -> `*const ()`) --> library\alloc\src\task.rs:323:13 | 323 | waker as *const (), | ^^^^^^^^^^^^^^^^^^ help: try: `waker` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting to the same type is unnecessary (`usize` -> `usize`) --> library\std\src\sys_common\net.rs:110:21 | 110 | assert!(len as usize >= mem::size_of::<c::sockaddr_in>()); | ^^^^^^^^^^^^ help: try: `len` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast warning: casting to the same type is unnecessary (`usize` -> `usize`) --> library\std\src\sys_common\net.rs:116:21 | 116 | assert!(len as usize >= mem::size_of::<c::sockaddr_in6>()); | ^^^^^^^^^^^^ help: try: `len` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
2024-03-24Rollup merge of #122992 - devnexen:available_parallelism_sol_upd, r=AmanieuMatthias Krüger-2/+6
std::thread: refine available_parallelism for solaris/illumos. Rather than the system-wide available cpus fallback solution, we fetch the cpus bound to the current process.
2024-03-24Rollup merge of #122984 - RalfJung:panic-in-hook, r=AmanieuMatthias Krüger-5/+10
panic-in-panic-hook: formatting a message that's just a string is risk-free This slightly improves the output in the 'panic while processing panic' case if the panic message does not involve any formatting. Follow-up to https://github.com/rust-lang/rust/pull/122930. r? ``@Amanieu``
2024-03-24Rollup merge of #122983 - taiki-e:bsd, r=workingjubileeMatthias Krüger-1/+1
Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSD Fixes https://github.com/rust-lang/rust/pull/121881#discussion_r1536764650 Checked targets: aarch64-unknown-freebsd, powerpc64-unknown-freebsd, armv7-unknown-freebsd, riscv64gc-unknown-freebsd, aarch64-unknown-netbsd. r? ``@Amanieu`` cc ``@devnexen``
2024-03-24fix build.David Carlier-5/+3
2024-03-24std::thread: refine available_parallelism for solaris/illumos.David Carlier-0/+6
Rather than the system-wide available cpus fallback solution, we fetch the cpus bound to the current process.
2024-03-24panic-in-panic-hook: formatting a message that's just a string is risk-freeRalf Jung-5/+10
2024-03-24Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSDTaiki Endo-1/+1
2024-03-23Rollup merge of #120419 - Ayush1325:uefi-sys-os, r=nicholasbishop,workingjubileeJubilee-10/+81
Expand sys/os for UEFI - Implement current_exe() and getcwd()
2024-03-23Fixed builds with modified libcAdam Gastineau-0/+3
2024-03-23Rollup merge of #122930 - RalfJung:panic-in-panic-fmt, r=AmanieuMatthias Krüger-1/+7
add panic location to 'panicked while processing panic' Fixes https://github.com/rust-lang/rust/issues/97181 r? `@Amanieu`
2024-03-23Rollup merge of #122916 - MultisampledNight:docs-sync-typo, r=jhprattMatthias Krüger-2/+2
docs(sync): normalize dot in fn summaries All other functions in e.g. [`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) have a dot at the end of their first doc line, except for the newly stabilized [`Mutex::clear_poison`](https://doc.rust-lang.org/std/sync/struct.Mutex.html#method.clear_poison) (and its friend [`RwLock::clear_poison`](https://doc.rust-lang.org/std/sync/struct.RwLock.html#method.clear_poison)). This PR remedies that by adding a normalizing dot.
2024-03-23rename ptr::from_exposed_addr -> ptr::with_exposed_provenanceRalf Jung-7/+7
2024-03-23add panic location to 'panicked while processing panic'Ralf Jung-1/+7
2024-03-23Auto merge of #119552 - krtab:dead_code_priv_mod_pub_field, r=cjgillot,saethlinbors-1/+7
Replace visibility test with reachability test in dead code detection Fixes https://github.com/rust-lang/rust/issues/119545 Also included is a fix for an error now flagged by the lint
2024-03-22docs(sync): normalize dot in fn summariesMultisampledNight-2/+2
2024-03-22Remove RustcEncodable/Decodable from 2024 preludeJacob Pratt-17/+23
2024-03-22Soft-destabilize `RustcEncodable`/`RustcDecodable`Jacob Pratt-1/+6
2024-03-22Avoid a panic in `set_output_capture` in the default panic handlerJohn Kåre Alsaker-9/+29