about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2024-12-14Rollup merge of #134254 - hermit-os:hermit-c_char, r=workingjubileeMatthias Krüger-6/+6
Fix building `std` for Hermit after `c_char` change These changes were made necessary by https://github.com/rust-lang/rust/pull/132975.
2024-12-14Rollup merge of #134252 - hermit-os:hermit-is_absolute, r=tgross35Matthias Krüger-1/+3
Fix `Path::is_absolute` on Hermit Paths on Hermit work like paths on Unix. Closes https://github.com/rust-lang/rust/issues/132141.
2024-12-13Rollup merge of #134140 - compiler-errors:unsafe-binders-ast, r=oli-obkMatthias Krüger-0/+2
Add AST support for unsafe binders I'm splitting up #130514 into pieces. It's impossible for me to keep up with a huge PR like that. I'll land type system support for this next, probably w/o MIR lowering, which will come later. r? `@oli-obk` cc `@BoxyUwU` and `@lcnr` who also may want to look at this, though this PR doesn't do too much yet
2024-12-13Fix building `std` for Hermit after `c_char` changeMartin Kröning-6/+6
2024-12-13Fix `Path::is_absolute` on HermitMartin Kröning-1/+3
2024-12-13Reword prelude for AsyncFn stabilizationMichael Goulet-2/+3
2024-12-13Stabilize async closuresMichael Goulet-1/+2
2024-12-12Add unwrap_unsafe_binder and wrap_unsafe_binder macro operatorsMichael Goulet-0/+2
2024-12-12Rollup merge of #134178 - ehuss:stabilize-2024-prelude, ↵Matthias Krüger-4/+13
r=amanieu,traviscross,tgross35 Stabilize the Rust 2024 prelude This stabilizes the `core::prelude::rust_2024` and `std::prelude::rust_2024` modules. I missed these in the #133349 stabilization.
2024-12-11Stabilize the Rust 2024 preludeEric Huss-4/+13
2024-12-11Forbid unsafe_op_in_unsafe_fn in hurd-specific os and sys filesSamuel Thibault-0/+1
Adding it did not cause any error. Most of this falls back on Unix already. See #127747
2024-12-10Rollup merge of #133472 - rust-wasi-web:master, r=joboetLeón Orell Valerian Liehr-1/+24
Run TLS destructors for wasm32-wasip1-threads The target wasm32-wasip1-threads has support for pthreads and allows registration of TLS destructors. For spawned threads, this registers Rust TLS destructors by creating a pthreads key with an attached destructor function. For the main thread, this registers an `atexit` handler to run the TLS destructors. try-job: test-various
2024-12-10Rollup merge of #133184 - osiewicz:wasm-fix-infinite-loop-in-remove-dir-all, ↵León Orell Valerian Liehr-70/+105
r=Noratrieb wasi/fs: Improve stopping condition for <ReadDir as Iterator>::next When upgrading [Zed](https://github.com/zed-industries/zed/pull/19349) to Rust 1.82 I've encountered a test failure in our test suite. Specifically, one of our extension tests started hanging. I've tracked it down to a call to std::fs::remove_dir_all not returning when an extension is compiled with Rust 1.82 Our extension system uses WASM components, thus I've looked at the diff between 1.81 and 1.82 with respect to WASI and found 736f773844e7ebf05ccb827c17b7ad9eb28aa295 As it turned out, calling remove_dir_all from extension returned io::ErrorKind::NotFound in 1.81; the underlying issue is that the ReadDir iterator never actually terminates iteration, however since it loops around, with 1.81 we'd come across an entry second time and fail to remove it, since it would've been removed previously. With 1.82 and 736f773844e7ebf05ccb827c17b7ad9eb28aa295 it is no longer the case, thus we're seeing the hang. The tests do pass when everything but the extensions is compiled with 1.82. This commit makes ReadDir::next adhere to readdir contract, namely it will no longer call readdir once the returned # of bytes is smaller than the size of a passed-in buffer. Previously we'd only terminate the loop if readdir returned 0.
2024-12-09Rollup merge of #133880 - ChrisDenton:homedir, r=Mark-SimulacrumMatthias Krüger-0/+7
Expand home_dir docs Since `home_dir` is set to be undeprecated, let's make the docs a bit more thorough.
2024-12-08Rollup merge of #133987 - Will-Low:DefineTlsAcronym, r=workingjubileeMatthias Krüger-1/+1
Define acronym for thread local storage There are multiple references in this module's documentation to the acronym "TLS" (meaning "thread local storage"), without defining it. This is confusing for the reader. I propose that this acronym be defined during the first use of the term.
2024-12-07Auto merge of #133978 - matthiaskrgr:rollup-6gh1iho, r=matthiaskrgrbors-14/+14
Rollup of 7 pull requests Successful merges: - #130209 (Stabilize `std::io::ErrorKind::CrossesDevices`) - #130254 (Stabilize `std::io::ErrorKind::QuotaExceeded`) - #132187 (Add Extend impls for tuples of arity 1 through 12) - #133875 (handle `--json-output` properly) - #133934 (Do not implement unsafe auto traits for types with unsafe fields) - #133954 (Hide errors whose suggestions would contain error constants or types) - #133960 (rustdoc: remove eq for clean::Attributes) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-06Define acronym for thread local storageWill-Low-1/+1
There are multiple references in this module's documentation to the acronym "TLS", without defining it. This is confusing for the reader. I propose that this acronym be defined during the first use of the term.
2024-12-06Auto merge of #118159 - EliasHolzmann:formatting_options, r=m-ou-sebors-1/+2
Implementation of `fmt::FormattingOptions` Tracking issue: #118117 Public API: ```rust #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct FormattingOptions { … } #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum Sign { Plus, Minus } #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum DebugAsHex { Lower, Upper } impl FormattingOptions { pub fn new() -> Self; pub fn sign(&mut self, sign: Option<Sign>) -> &mut Self; pub fn sign_aware_zero_pad(&mut self, sign_aware_zero_pad: bool) -> &mut Self; pub fn alternate(&mut self, alternate: bool) -> &mut Self; pub fn fill(&mut self, fill: char) -> &mut Self; pub fn align(&mut self, alignment: Option<Alignment>) -> &mut Self; pub fn width(&mut self, width: Option<usize>) -> &mut Self; pub fn precision(&mut self, precision: Option<usize>) -> &mut Self; pub fn debug_as_hex(&mut self, debug_as_hex: Option<DebugAsHex>) -> &mut Self; pub fn get_sign(&self) -> Option<Sign>; pub fn get_sign_aware_zero_pad(&self) -> bool; pub fn get_alternate(&self) -> bool; pub fn get_fill(&self) -> char; pub fn get_align(&self) -> Option<Alignment>; pub fn get_width(&self) -> Option<usize>; pub fn get_precision(&self) -> Option<usize>; pub fn get_debug_as_hex(&self) -> Option<DebugAsHex>; pub fn create_formatter<'a>(self, write: &'a mut (dyn Write + 'a)) -> Formatter<'a>; } impl<'a> Formatter<'a> { pub fn new(write: &'a mut (dyn Write + 'a), options: FormattingOptions) -> Self; pub fn with_options<'b>(&'b mut self, options: FormattingOptions) -> Formatter<'b>; pub fn sign(&self) -> Option<Sign>; pub fn options(&self) -> FormattingOptions; } ``` Relevant changes from the public API in the tracking issue (I'm leaving out some stuff I consider obvious mistakes, like missing `#[derive(..)]`s and `pub` specifiers): - `enum DebugAsHex`/`FormattingOptions::debug_as_hex`/`FormattingOptions::get_debug_as_hex`: To support `{:x?}` as well as `{:X?}`. I had completely missed these options in the ACP. I'm open for any and all bikeshedding, not married to the name. - `fill`/`get_fill` now takes/returns `char` instead of `Option<char>`. This simply mirrors what `Formatter::fill` returns (with default being `' '`). - Changed `zero_pad`/`get_zero_pad` to `sign_aware_zero_pad`/`get_sign_aware_zero_pad`. This also mirrors `Formatter::sign_aware_zero_pad`. While I'm not a fan of this quite verbose name, I do believe that having the interface of `Formatter` and `FormattingOptions` be compatible is more important. - For the same reason, renamed `alignment`/`get_alignment` to `aling`/`get_align`. - Deviating from my initial idea, `Formatter::with_options` returns a `Formatter` which has the lifetime of the `self` reference as its generic lifetime parameter (in the original API spec, the generic lifetime of the returned `Formatter` was the generic lifetime used by `self` instead). Otherwise, one could construct two `Formatter`s that both mutably borrow the same underlying buffer, which would be unsound. This solution still has performance benefits over simply using `Formatter::new`, so I believe it is worthwhile to keep this method.
2024-12-06Rollup merge of #130254 - GrigorenkoPV:QuotaExceeded, r=dtolnayMatthias Krüger-13/+13
Stabilize `std::io::ErrorKind::QuotaExceeded` Also drop "Filesystem" from its name. See #130190 for more info. FCP in #130190 cc #86442 r? `@dtolnay`
2024-12-06Rollup merge of #130209 - GrigorenkoPV:CrossesDevices, r=dtolnayMatthias Krüger-1/+1
Stabilize `std::io::ErrorKind::CrossesDevices` FCP in #130191 cc #86442 See #130191 for more info and a recap of what has happened up until now. TLDR: This had been FCP'd in December 2022 with some other `ErrorKind`s, but the stabilization got postponed due to some concerns voiced about several of the variants. However, the only concern ever voiced for this variant in particular was a wish to rename this to `NotSameDevice` analogous to Windows's `ERROR_NOT_SAME_DEVICE` (as opposed to Unix's `EXDEV`). This suggestion did not receive any support. So let's try to FCP this as is. r? libs-api
2024-12-05Added struct `fmt::FormattingOptions`Elias Holzmann-1/+2
This allows to build custom `std::Formatter`s at runtime. Also added some related enums and two related methods on `std::Formatter`.
2024-12-05Add libc funcitons only for wasm32-wasip1-threads.Sebastian Urban-1/+1
2024-12-05Fix compilation for wasm32-wasip1 (without threads).Sebastian Urban-2/+4
2024-12-05Rollup merge of #133882 - jyn514:doc-backtraces, r=saethlinJacob Pratt-14/+12
Improve comments for the default backtrace printer The existing comments were misleading, confusing, and outdated. Take this comment for example: ``` // Any frames between `__rust_begin_short_backtrace` and `__rust_end_short_backtrace` // are omitted from the backtrace in short mode, `__rust_end_short_backtrace` will be // called before the panic hook, so we won't ignore any frames if there is no // invoke of `__rust_begin_short_backtrace`. ``` this is just wrong. here is an example (full) backtrace: <details> ``` Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s Running `/home/jyn/.local/lib/cargo/target/debug/example` called `Option::unwrap()` on a `None` value stack backtrace: 0: 0x56499698c595 - std::backtrace_rs::backtrace::libunwind::trace::h5ef2cc16e9a7415a 1: 0x56499698c595 - std::backtrace_rs::backtrace::trace_unsynchronized::h9b5e016e9075f714 2: 0x56499698c595 - std::sys_common::backtrace::_print_fmt::h2f62c7f9ff224e93 3: 0x56499698c595 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbe51682735731910 4: 0x5649969aa26b - core::fmt::rt::Argument::fmt::h1994ab2b310d665e 5: 0x5649969aa26b - core::fmt::write::hade58a36d63468d7 6: 0x56499698a43f - std::io::Write::write_fmt::h16145587d801a9ab 7: 0x56499698c36e - std::sys_common::backtrace::_print::ha8082e56201dadb4 8: 0x56499698c36e - std::sys_common::backtrace::print::he30f96b4e7f6cbfd 9: 0x56499698d709 - std::panicking::default_hook::{{closure}}::hf0801f6b18a968d3 10: 0x56499698d4ac - std::panicking::default_hook::hd2defec7eda5aeb0 11: 0x56499698dc31 - std::panicking::rust_panic_with_hook::hde93283600065c53 12: 0x56499698daf3 - std::panicking::begin_panic_handler::{{closure}}::h5e151adbdb7ec0c1 13: 0x56499698ca59 - std::sys_common::backtrace::__rust_end_short_backtrace::he36a1407e0f77700 14: 0x56499698d7d4 - rust_begin_unwind 15: 0x5649969a9503 - core::panicking::panic_fmt::h2380d41365f95412 16: 0x5649969a958c - core::panicking::panic::h38cf8db80e8c6e67 17: 0x5649969a93e9 - core::option::unwrap_failed::he72696e53ff29a05 18: 0x5649969722b6 - core::option::Option<T>::unwrap::hb574dc0dc1703062 19: 0x5649969722b6 - example::main::h7a867aafacd93d75 20: 0x5649969721db - core::ops::function::FnOnce::call_once::h734f99a5e57291b7 21: 0x56499697226e - std::sys_common::backtrace::__rust_begin_short_backtrace::h02f5d58c351c4756 22: 0x564996972241 - std::rt::lang_start::{{closure}}::h8b134fe2c31a4355 23: 0x564996988662 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h88d7bb571ee2aaf4 24: 0x564996988662 - std::panicking::try::do_call::hfb78dfb6599c871d 25: 0x564996988662 - std::panicking::try::habd041c8c4c8e50c 27: 0x564996988662 - std::rt::lang_start_internal::{{closure}}::h227591a6f9c0879e 28: 0x564996988662 - std::panicking::try::do_call::h3c5878333c38916a 29: 0x564996988662 - std::panicking::try::h5af7b3a127cdae70 31: 0x564996988662 - std::rt::lang_start_internal::hbc85e809eeace0dd 32: 0x56499697221a - std::rt::lang_start::ha1eb16922c9cb224 33: 0x5649969722ee - main 34: 0x7f031962a1ca - __libc_start_call_main 35: 0x7f031962a28b - __libc_start_main_impl 36: 0x5649969720a5 - _start 37: 0x0 - <unknown> ``` </details> note particularly frames 13-21, from start_backtrace to end_backtrace. with PrintFmt::Short, these are the *only* frames that are printed; i.e. we are doing the exact opposite of the comment. r? ``@saethlin``
2024-12-04Improve comments for the default backtrace printerjyn-14/+12
The existing comments were misleading, confusing, and wrong. Take this comment for example: ``` // Any frames between `__rust_begin_short_backtrace` and `__rust_end_short_backtrace` // are omitted from the backtrace in short mode, `__rust_end_short_backtrace` will be // called before the panic hook, so we won't ignore any frames if there is no // invoke of `__rust_begin_short_backtrace`. ``` this is just wrong. here is an example (full) backtrace: ``` Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s Running `/home/jyn/.local/lib/cargo/target/debug/example` called `Option::unwrap()` on a `None` value stack backtrace: 0: 0x56499698c595 - std::backtrace_rs::backtrace::libunwind::trace::h5ef2cc16e9a7415a 1: 0x56499698c595 - std::backtrace_rs::backtrace::trace_unsynchronized::h9b5e016e9075f714 2: 0x56499698c595 - std::sys_common::backtrace::_print_fmt::h2f62c7f9ff224e93 3: 0x56499698c595 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbe51682735731910 4: 0x5649969aa26b - core::fmt::rt::Argument::fmt::h1994ab2b310d665e 5: 0x5649969aa26b - core::fmt::write::hade58a36d63468d7 6: 0x56499698a43f - std::io::Write::write_fmt::h16145587d801a9ab 7: 0x56499698c36e - std::sys_common::backtrace::_print::ha8082e56201dadb4 8: 0x56499698c36e - std::sys_common::backtrace::print::he30f96b4e7f6cbfd 9: 0x56499698d709 - std::panicking::default_hook::{{closure}}::hf0801f6b18a968d3 10: 0x56499698d4ac - std::panicking::default_hook::hd2defec7eda5aeb0 11: 0x56499698dc31 - std::panicking::rust_panic_with_hook::hde93283600065c53 12: 0x56499698daf3 - std::panicking::begin_panic_handler::{{closure}}::h5e151adbdb7ec0c1 13: 0x56499698ca59 - std::sys_common::backtrace::__rust_end_short_backtrace::he36a1407e0f77700 14: 0x56499698d7d4 - rust_begin_unwind 15: 0x5649969a9503 - core::panicking::panic_fmt::h2380d41365f95412 16: 0x5649969a958c - core::panicking::panic::h38cf8db80e8c6e67 17: 0x5649969a93e9 - core::option::unwrap_failed::he72696e53ff29a05 18: 0x5649969722b6 - core::option::Option<T>::unwrap::hb574dc0dc1703062 19: 0x5649969722b6 - example::main::h7a867aafacd93d75 20: 0x5649969721db - core::ops::function::FnOnce::call_once::h734f99a5e57291b7 21: 0x56499697226e - std::sys_common::backtrace::__rust_begin_short_backtrace::h02f5d58c351c4756 22: 0x564996972241 - std::rt::lang_start::{{closure}}::h8b134fe2c31a4355 23: 0x564996988662 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h88d7bb571ee2aaf4 24: 0x564996988662 - std::panicking::try::do_call::hfb78dfb6599c871d 25: 0x564996988662 - std::panicking::try::habd041c8c4c8e50c 27: 0x564996988662 - std::rt::lang_start_internal::{{closure}}::h227591a6f9c0879e 28: 0x564996988662 - std::panicking::try::do_call::h3c5878333c38916a 29: 0x564996988662 - std::panicking::try::h5af7b3a127cdae70 31: 0x564996988662 - std::rt::lang_start_internal::hbc85e809eeace0dd 32: 0x56499697221a - std::rt::lang_start::ha1eb16922c9cb224 33: 0x5649969722ee - main 34: 0x7f031962a1ca - __libc_start_call_main 35: 0x7f031962a28b - __libc_start_main_impl 36: 0x5649969720a5 - _start 37: 0x0 - <unknown> ``` note particularly frames 13-21, from start_backtrace to end_backtrace. with PrintFmt::Short, these are the *only* frames that are printed; i.e. we are doing the exact opposite of the comment.
2024-12-05Expand home_dir docsChris Denton-0/+7
2024-12-04Rename `core_pattern_type` and `core_pattern_types` lib feature gates to ↵Oli Scherer-1/+1
`pattern_type_macro` That's what the gates are actually gating, and the single char difference in naming was not helpful either
2024-12-04Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgrbors-3/+3
Rollup of 7 pull requests Successful merges: - #132937 (a release operation synchronizes with an acquire operation) - #133681 (improve TagEncoding::Niche docs, sanity check, and UB checks) - #133726 (Add `core::arch::breakpoint` and test) - #133768 (Remove `generic_associated_types_extended` feature gate) - #133811 ([AIX] change AIX default codemodel=large) - #133812 (Update wasm-component-ld to 0.5.11) - #133813 (compiletest: explain that UI tests are expected not to compile by default) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-03Rollup merge of #132937 - xmh0511:master, r=m-ou-seMatthias Krüger-3/+3
a release operation synchronizes with an acquire operation Change: 1. `Calls to park _synchronize-with_ calls to unpark` to `Calls to unpark _synchronize-with_ calls to park` 2. `park synchronizes-with _all_ prior unpark operations` to `_all_ prior unpark operations synchronize-with park`
2024-12-03Rollup merge of #133696 - RalfJung:const-hashmap, r=cuviperMatthias Krüger-3/+46
stabilize const_collections_with_hasher and build_hasher_default_const_new After a lot of preparatory work, finally we can stabilize creating `HashMap` in const context. :) FCP for const_collections_with_hasher passed in https://github.com/rust-lang/rust/issues/102575. Fixes https://github.com/rust-lang/rust/issues/102575. FCP for build_hasher_default_const_new passed in https://github.com/rust-lang/rust/issues/123197. Fixes https://github.com/rust-lang/rust/issues/123197. Cc `@Amanieu` Release notes: https://github.com/rust-lang/rust/issues/133347
2024-12-03Use UNIX thread_local implementation for WASI.Sebastian Urban-75/+22
2024-12-03./x miri: fix sysroot buildRalf Jung-4/+4
2024-12-02Use c"lit" for CStrings without unwrapKornel-1/+1
2024-12-02stabilize const_collections_with_hasher and build_hasher_default_const_newRalf Jung-3/+46
2024-12-02Auto merge of #133728 - jhpratt:rollup-k1i60pg, r=jhprattbors-2/+0
Rollup of 4 pull requests Successful merges: - #133589 (Remove `hir::ArrayLen`) - #133672 (Remove a bunch of unnecessary const stability noise) - #133678 (Stabilize `ptr::fn_addr_eq`) - #133727 (Update mailmap) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-01Rollup merge of #133672 - RalfJung:const-stability-cleanup, r=jhprattJacob Pratt-2/+0
Remove a bunch of unnecessary const stability noise
2024-12-01add isatty alias for is_terminalcod10129-0/+1
2024-12-01Rollup merge of #133622 - mkroening:exception-blog, r=cuviperMatthias Krüger-1/+1
update link to "C++ Exceptions under the hood" blog The link was introduced in 0ec321f7b541fcbfbf20286beb497e6d9d3352b2. For the old link, see https://web.archive.org/web/20170409223244/https://monoinfinito.wordpress.com/series/exception-handling-in-c/. The blog has migrated from WordPress to Blogger in 2021 and to GitHub pages in 2024.
2024-12-01Rollup merge of #133602 - SanchithHegde:fix-pathbuf-example-codeblocks, ↵Matthias Krüger-0/+2
r=cuviper fix: fix codeblocks in `PathBuf` example This PR adds missing codeblocks around an example included in the `PathBuf` documentation.
2024-12-01Rollup merge of #133515 - SteveLauC:fix/hurd, r=ChrisDentonMatthias Krüger-1/+3
fix: hurd build, stat64.st_fsid was renamed to st_dev On hurd, `stat64.st_fsid` was renamed to `st_dev` in https://github.com/rust-lang/libc/pull/3785, so if you have a new libc with this patch included, and you build std from source, you get this error: ```sh error[E0609]: no field `st_fsid` on type `&stat64` --> /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/hurd/fs.rs:301:36 | 301 | self.as_inner().as_inner().st_fsid as u64 | ^^^^^^^ unknown field | help: a field with a similar name exists | 301 | self.as_inner().as_inner().st_uid as u64 | ~~~~~~ ``` Full CI log: https://github.com/nix-rust/nix/actions/runs/12033180710/job/33546728266?pr=2544
2024-12-01Rollup merge of #128184 - joboet:refactor_pthread_sync, r=workingjubileeMatthias Krüger-438/+465
std: refactor `pthread`-based synchronization The non-trivial code for `pthread_condvar` is duplicated across the thread parking and the `Mutex`/`Condvar` implementations. This PR moves that code into `sys::pal`, which now exposes an `unsafe` wrapper type for `pthread_mutex_t` and `pthread_condvar_t`.
2024-11-30Switch rtems target to panic unwindJan Sommer-1/+1
2024-11-30Auto merge of #133659 - jieyouxu:rollup-576gh4p, r=jieyouxubors-15/+21
Rollup of 6 pull requests Successful merges: - #131551 (Support input/output in vector registers of PowerPC inline assembly) - #132515 (Fix and undeprecate home_dir()) - #132721 (CI: split x86_64-mingw job) - #133106 (changes old intrinsic declaration to new declaration) - #133496 (thread::available_parallelism for wasm32-wasip1-threads) - #133548 (Add `BTreeSet` entry APIs to match `HashSet`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-30std: clarify comments about initializationjoboet-11/+13
2024-11-30Add value accessor methods to `Mutex` and `RwLock`EFanZh-86/+517
2024-11-30fix: hurd build, stat64.st_fsid was renamed to st_devSteve Lau-1/+3
2024-11-30remove a whole bunch of unnecessary const feature gatesRalf Jung-2/+0
2024-11-30Abstract `ProcThreadAttributeList` into its own structMichael van Straten-151/+294
2024-11-30Rollup merge of #133496 - rust-wasi-web:wasi-available-parallelism, r=Amanieu许杰友 Jieyou Xu (Joe)-3/+13
thread::available_parallelism for wasm32-wasip1-threads The target has limited POSIX support and provides the `libc::sysconf` function which allows querying the number of available CPUs.
2024-11-30Rollup merge of #132515 - kornelski:home_fix, r=jhpratt许杰友 Jieyou Xu (Joe)-12/+8
Fix and undeprecate home_dir() `home_dir()` has been deprecated for 6 years due to using `HOME` env var on Windows. It's been a long time, and having a perpetually buggy and deprecated function in the standard library is not useful. I propose fixing and undeprecating it. 6 years seems more than long enough to warn users against relying on this function. The change in behavior is minor, and it's more of a bug fix than breakage. The old behavior is unlikely to be useful, and even if anybody actually needed to specifically use the non-standard `HOME` on Windows, they can trivially mitigate this change by reading the env var themselves. ---- Use of `USERPROFILE` is in line with the `home` crate: https://github.com/rust-lang/cargo/blob/37bc5f0232a0bb72dedd2c14149614fd8cdae649/crates/home/src/windows.rs#L12 The `home` crate uses `SHGetKnownFolderPath` instead of `GetUserProfileDirectoryW`. AFAIK it doesn't make any difference in practice, because `SHGetKnownFolderPath` merely adds support for more kinds of folders, including virtual (non-filesystem) folders identified by a GUID, but the specific case of [`FOLDERID_Profile`](https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid#FOLDERID_Profile) is documented as a FIXED folder (a regular filesystem path). Just in case, I've added a note to documentation that the use of `GetUserProfileDirectoryW` can change. I've used `CURRENT_RUSTC_VERSION` in a doccomment. `replace-version-placeholder` tool seems to perform a simple string replacement, so hopefully it'll get updated.