about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2024-06-11Move deprecation of std::panic::PanicInfo to 1.80.0.Mara Bos-1/+1
2024-06-11Rename std::panic::PanicInfo to PanicHookInfo.Mara Bos-23/+33
2024-06-11Reorder body of begin_panic for consistency.Mara Bos-17/+11
In the other functions, we put the struct and impl blocks first, such that the return expression can be at the end of the body as usual.
2024-06-11Impl Display for PanicPayload to simplify things.Mara Bos-9/+28
2024-06-11Use unnamed lifetimes for [..]Payload impl blocks.Mara Bos-7/+3
2024-06-11Move downcasting panic payload to str to a function.Mara Bos-7/+11
2024-06-11Mark some PanicInfo methods as #[inline] for consistency.Mara Bos-0/+3
2024-06-11Remove std::panic::PanicInfo::internal_constructor+set_payload.Mara Bos-21/+7
We can just set the payload immediately in the constructor, and the constructor does not need to be public.
2024-06-11Fix doc link.Mara Bos-3/+2
2024-06-11Document difference between core and std's PanicInfo.Mara Bos-2/+9
2024-06-11Split core's PanicInfo and std's PanicInfo.Mara Bos-22/+168
2024-06-10Bump windows-bindgen to 0.57Chris Denton-417/+66
2024-06-10Clarify `Command::new` behavior if passed programs with arguments许杰友 Jieyou Xu (Joe)-0/+19
2024-06-10fix: build on haikuSteve Lau-2/+2
2024-06-09Migrate more things to WinErrorChris Denton-30/+69
2024-06-09Rollup merge of #126168 - devnexen:current_exe_haiku_simpl, r=ChrisDentonMatthias Krüger-10/+10
std::unix::os current_exe implementation simplification for haiku. _get_net_image_info is a bit overkill as it allows to get broader informations about the process.
2024-06-09Rollup merge of #126146 - devnexen:signal_fbsd, r=ChrisDentonMatthias Krüger-0/+4
std::unix::process adding few specific freebsd signals to be able to id.
2024-06-08std::unix::os current_exe implementation simplification for haiku.David Carlier-10/+10
_get_net_image_info is a bit overkill as it allows to get broader informations about the process.
2024-06-08Auto merge of #125966 - schvv31n:impl_os_string_pathbuf_leak, r=workingjubileebors-0/+72
Implement `os_string_pathbuf_leak` implementation of #125965 ACP: https://github.com/rust-lang/libs-team/issues/389 [ Accepted ]
2024-06-08std::unix::process adding few specific freebsd signals to be able to id.David Carlier-0/+4
2024-06-08Rollup merge of #125998 - devnexen:get_mode_illumos, r=NilstriebLeón Orell Valerian Liehr-0/+4
std::unix::fs::get_mode implementation for illumos/solaris. they both support the F_GETFL fctnl flag/O_ACCMODE mask to get the file descriptor access modes.
2024-06-08Rollup merge of #125951 - slanterns:error_in_core_stabilization, r=AmanieuLeón Orell Valerian Liehr-1/+0
Stabilize `error_in_core` Closes: https://github.com/rust-lang/rust/issues/103765. `@rustbot` label: +T-libs-api r? libs-api
2024-06-07add HermitOS support of vectored read/write operationsStefan Lankes-91/+180
In general, the I/O interface of hermit-abi is more POSIX-like interface. Consequently, platform abstraction layer for HermitOS has slightly adjusted and some inaccuracies remove.
2024-06-07Rollup merge of #126030 - ChrisDenton:update-wingen-readme, r=Mark-SimulacrumMatthias Krüger-1/+1
Update `./x fmt` command in library/std/src/sys/pal/windows/c/README.md `./x fmt` no longer accepts paths so the command in the readme won't work.
2024-06-07Stabilize `error_in_core`Slanterns-1/+0
2024-06-06fixed memory leaks in PathBuf::leak & OsString::leak testsschvv31n-1/+6
2024-06-05Raise `DEFAULT_MIN_STACK_SIZE` to at least 64KiBJubilee Young-4/+4
Prevent copy-paste errors from producing new starved-for-resources threaded platforms by raising `DEFAULT_MIN_STACK_SIZE` from 4096 bytes to at least 64KiB. Two platforms "affected" by this have no actual threads: - UEFI - "unsupported" Platforms that this actually affects: - wasm32-wasi with "atomics" enabled - wasm32-wasi-p1-threads Two exceptions: - SGX: a "secure code execution" platform, stays at 4096B - TEEOS: also a "secure code execution" platform, stays at 8192B I believe either of these may have sufficiently "interesting" semantics around threads, or significant external library support. Either would mean making any choices here for them is suspect.
2024-06-05Auto merge of #126038 - matthiaskrgr:rollup-h4rm3x2, r=matthiaskrgrbors-17/+11
Rollup of 9 pull requests Successful merges: - #124840 (resolve: mark it undetermined if single import is not has any bindings) - #125622 (Winnow private method candidates instead of assuming any candidate of the right name will apply) - #125648 (Remove unused(?) `~/rustsrc` folder from docker script) - #125672 (Add more ABI test cases to miri (RFC 3391)) - #125800 (Fix `mut` static task queue in SGX target) - #125871 (Orphanck[old solver]: Consider opaque types to never cover type parameters) - #125893 (Handle all GVN binops in a single place.) - #126008 (Port `tests/run-make-fulldeps/issue-19371` to ui-fulldeps) - #126032 (Update description of the `IsTerminal` example) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-05Promote `arm64ec-pc-windows-msvc` to tier 2Daniel Paoliello-1/+5
2024-06-05Rollup merge of #126032 - ChrisDenton:update-docs, r=joboetMatthias Krüger-3/+2
Update description of the `IsTerminal` example The example code prompts for input if stdin is a terminal.
2024-06-05Rollup merge of #125800 - fortanix:raoul/rte-99-fix_mut_static_task_queue, ↵Matthias Krüger-14/+9
r=jethrogb Fix `mut` static task queue in SGX target [PR 125046](https://github.com/rust-lang/rust/pull/125046) prevents mutable references to statics with `#[linkage]`. Such a construct was used with the tests for the `x86_64-fortanix-unknown-sgx` target. This PR fixes this and cleans up code a bit in 5 steps. Each step passes CI: - The `mut` static is removed, and `Task` explicitly implements `Send` - Renaming of the `task_queue::lock` function - Pass function for `Thread` as `Send` to `Thread::imp` and update when `Packet<'scope, T>` implements `Sync` - Storing `Task::p` as a type that implements `Send` - Letting the compiler auto implement `Send` for `Task` cc: ``@jethrogb``
2024-06-05Rollup merge of #125940 - devnexen:unix_fs_netbsd_get_path, r=cuviperMatthias Krüger-9/+13
std::unix::fs::get_path: using fcntl codepath for netbsd instead. on netbsd, procfs is not as central as on linux/solaris thus can be perfectly not mounted. Thus using fcntl with F_GETPATH, the kernel deals with MAXPATHLEN internally too.
2024-06-05Update description of the `IsTerminal` exampleChris Denton-3/+2
2024-06-05Update `./x fmt` commandChris Denton-1/+1
2024-06-05Rollup merge of #123168 - joshtriplett:size-of-prelude, r=AmanieuJubilee-2/+8
Add `size_of` and `size_of_val` and `align_of` and `align_of_val` to the prelude (Note: need to update the PR to add `align_of` and `align_of_val`, and remove the second commit with the myriad changes to appease the lint.) Many, many projects use `size_of` to get the size of a type. However, it's also often equally easy to hardcode a size (e.g. `8` instead of `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps ensure that people use it and make code more self-documenting. The name `size_of` is unambiguous: the name alone, without any prefix or path, is self-explanatory and unmistakeable for any other functionality. Adding it to the prelude cannot produce any name conflicts, as any local definition will silently shadow the one from the prelude. Thus, we don't need to wait for a new edition prelude to add it.
2024-06-04std::unix::fs::get_mode implementation for illumos/solaris.David Carlier-0/+4
they both support the F_GETFL fctnl flag/O_ACCMODE mask to get the file descriptor access modes.
2024-06-04Rollup merge of #125932 - schvv31n:patch-1, r=lqdGuillaume Gomez-1/+1
Fix typo in the docs of `HashMap::raw_entry_mut` <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> -->
2024-06-04Rollup merge of #125696 - workingjubilee:please-dont-say-you-are-lazy, ↵Guillaume Gomez-59/+73
r=Nilstrieb Explain differences between `{Once,Lazy}{Cell,Lock}` types The question of "which once-ish cell-ish type should I use?" has been raised multiple times, and is especially important now that we have stabilized the `LazyCell` and `LazyLock` types. The answer for the `Lazy*` types is that you would be better off using them if you want to use what is by far the most common pattern: initialize it with a single nullary function that you would call at every `get_or_init` site. For everything else there's the `Once*` types. "For everything else" is a somewhat weak motivation, as it only describes by negation. While contrasting them is inevitable, I feel positive motivations are more understandable. For this, I now offer a distinct example that helps explain why `OnceLock` can be useful, despite `LazyLock` existing: you can do some cool stuff with it that `LazyLock` simply can't support due to its mere definition. The pair of `std::sync::*Lock`s are usable inside a `static`, and can serve roles in async or multithreaded (or asynchronously multithreaded) programs that `*Cell`s cannot. Because of this, they received most of my attention. Fixes #124696 Fixes #125615
2024-06-04impl OsString::leak & PathBuf::leakschvv31n-0/+67
2024-06-04Rollup merge of #125919 - tbu-:pr_fix_typo, r=lqd许杰友 Jieyou Xu (Joe)-2/+1
Remove stray "this"
2024-06-04Rollup merge of #125504 - mqudsi:once_nominal, r=cuviper许杰友 Jieyou Xu (Joe)-1/+1
Change pedantically incorrect OnceCell/OnceLock wording While the semantic intent of a OnceCell/OnceLock is that it can only be written to once (upon init), the fact of the matter is that both these types offer a `take(&mut self) -> Option<T>` mechanism that, when successful, resets the cell to its initial state, thereby [technically allowing it to be written to again](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=415c023a6ae1ef35f371a2d3bb1aa735) Despite the fact that this can only happen with a mutable reference (generally only used during the construction of the OnceCell/OnceLock), it would be incorrect to say that the type itself as a whole *categorically* prevents being initialized or written to more than once (since it is possible to imagine an identical type only without the `take()` method that actually fulfills that contract). To clarify, change "that cannot be.." to "that nominally cannot.." and add a note to OnceCell about what can be done with an `&mut Self` reference. ```@rustbot``` label +A-rustdocs
2024-06-04Let compiler auto impl `Send` for `Task`Raoul Strackx-2/+0
2024-06-04Store `Task::p` as `dyn FnOnce() + Send`Raoul Strackx-3/+3
2024-06-04Pass function for `Thread` as `Send` to `Thread::imp`Raoul Strackx-2/+3
2024-06-04Windows: Use futex implementation for `Once`Timo Kröger-0/+1
Keep the queue implementation for win7. Inspired by PR #121956
2024-06-04Auto merge of #125525 - joboet:tls_accessor, r=cuviperbors-180/+107
Make TLS accessors closures that return pointers The current TLS macros generate a function that returns an `Option<&'static T>`. This is both risky as we lie about lifetimes, and necessitates that those functions are `unsafe`. By returning a `*const T` instead, the accessor function do not have safety requirements any longer and can be made closures without hassle. This PR does exactly that! For native TLS, the closure approach makes it trivial to select the right accessor function at compile-time, which could result in a slight speed-up (I have the hope that the accessors are now simple enough for the MIR-inliner to kick in).
2024-06-04std::unix::fs::get_path: using fcntl codepath for netbsd instead.David Carlier-9/+13
on netbsd, procfs is not as central as on linux/solaris thus can be perfectly not mounted. Thus using fcntl with F_GETPATH, the kernel deals with MAXPATHLEN internally too.
2024-06-03Fix typo in the docs of `HashMap::raw_entry_mut`Tim Kurdov-1/+1
2024-06-03Remove stray "this"Tobias Bucher-2/+1
2024-06-02Add "OnceList" example to motivate OnceLockJubilee Young-0/+55
While slightly verbose, it helps explain "why bother with OnceLock?" This is a point of confusion that has been raised multiple times shortly before and after the stabilization of LazyLock.