about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2022-11-13Rollup merge of #104300 - tbu-:pr_path_parent_caveats, r=Mark-SimulacrumManish Goregaokar-1/+12
Document `Path::parent` behavior around relative paths A relative path with just one component will return `Some("")` as its parent, which wasn't clear to me from the documentation. The parent of `""` is `None`, which was missing from the documentation as well.
2022-11-14Auto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbinibors-1/+1
Bump bootstrap compiler to 1.66 This PR: - Bumps version placeholders to release - Bumps to latest beta - cfg-steps code r? `@pietroalbini`
2022-11-13Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomccbors-1/+1
Change the way libunwind is linked for *-windows-gnullvm targets I have no idea why previous way works for `x86_64-fortanix-unknown-sgx` (assuming it actually works...) but not for `gnullvm`. It fails when linking libtest during Rust build (unless somebody adds `RUSTFLAGS='-Clinkarg=-lunwind'`). Also fixes exception handling on AArch64.
2022-11-13just use `libc::clockid_t`Cameron-8/+3
2022-11-13Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targetsJoy-3/+23
2022-11-13Remove unused diagnostic itemsMaybe Waffle-2/+0
2022-11-13Auto merge of #93563 - ibraheemdev:crossbeam-channel, r=Amanieubors-2848/+2739
Merge crossbeam-channel into `std::sync::mpsc` This PR imports the [`crossbeam-channel`](https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-channel#crossbeam-channel) crate into the standard library as a private module, `sync::mpmc`. `sync::mpsc` is now implemented as a thin wrapper around `sync::mpmc`. The primary purpose of this PR is to resolve https://github.com/rust-lang/rust/issues/39364. The public API intentionally remains the same. The reason https://github.com/rust-lang/rust/issues/39364 has not been fixed in over 5 years is that the current channel is *incredibly* complex. It was written many years ago and has sat mostly untouched since. `crossbeam-channel` has become the most popular alternative on crates.io, amassing over 30 million downloads. While crossbeam's channel is also complex, like all fast concurrent data structures, it avoids some of the major issues with the current implementation around dynamic flavor upgrades. The new implementation decides on the datastructure to be used when the channel is created, and the channel retains that structure until it is dropped. Replacing `sync::mpsc` with a simpler, less performant implementation has been discussed as an alternative. However, Rust touts itself as enabling *fearless concurrency*, and having the standard library feature a subpar implementation of a core concurrency primitive doesn't feel right. The argument is that slower is better than broken, but this PR shows that we can do better. As mentioned before, the primary purpose of this PR is to fix https://github.com/rust-lang/rust/issues/39364, and so the public API intentionally remains the same. *After* that problem is fixed, the fact that `sync::mpmc` now exists makes it easier to fix the primary limitation of `mpsc`, the fact that it only supports a single consumer. spmc and mpmc are two other common concurrency patterns, and this change enables a path to deprecating `mpsc` and exposing a general `sync::channel` module that supports multiple consumers. It also implements other useful methods such as `send_timeout`. That said, exposing MPMC and other new functionality is mostly out of scope for this PR, and it would be helpful if discussion stays on topic :) For what it's worth, the new implementation has also been shown to be more performant in [some basic benchmarks](https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-channel/benchmarks#results). cc `@taiki-e` r? rust-lang/libs
2022-11-12avoid using channels in thread-local testsIbraheem Ahmed-22/+44
2022-11-12avoid calling `thread::current` in channel destructorIbraheem Ahmed-13/+11
2022-11-12Use correct EH personality on `*-windows-gnu-*`Mateusz Mikuła-1/+1
2022-11-12Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obkDylan DPC-0/+4
Add the `#[derive_const]` attribute Closes #102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to. r? `````@oli-obk`````
2022-11-12Auto merge of #103150 - joboet:remove_lock_wrappers, r=m-ou-sebors-653/+404
Remove lock wrappers in `sys_common` This moves the lazy allocation to `sys` (SGX and UNIX). While this leads to a bit more verbosity, it will simplify future improvements by making room in `sys_common` for platform-independent implementations. This also removes the condvar check on SGX as it is not necessary for soundness and will be removed anyway once mutex has been made movable. For simplicity's sake, `libunwind` also uses lazy allocation now on SGX. This will require an update to the C definitions before merging this (CC `@raoulstrackx).` r? `@m-ou-se`
2022-11-11Document `Path::parent` behavior around relative pathsTobias Bucher-1/+12
A relative path with just one component will return `Some("")` as its parent, which wasn't clear to me from the documentation. The parent of `""` is `None`, which was missing from the documentation as well.
2022-11-10Rollup merge of #104060 - ink-feather-org:const_hash, r=fee1-deadManish Goregaokar-3/+7
Make `Hash`, `Hasher` and `BuildHasher` `#[const_trait]` and make `Sip` const `Hasher` This PR enables using Hashes in const context. r? ``@fee1-dead``
2022-11-09tidyIbraheem Ahmed-5/+4
2022-11-09spin less in `mpsc::SyncSender::send`Ibraheem Ahmed-1/+1
2022-11-09remove extra spinning from `mpsc` parkerIbraheem Ahmed-15/+0
2022-11-09`sync::mpsc`: quadratic backoffIbraheem Ahmed-2/+3
2022-11-09`sync::mpsc`: reload state after spinning on CAS failureIbraheem Ahmed-8/+8
2022-11-09remove extra spinning from `mpsc::Receiver::recv`Ibraheem Ahmed-26/+6
2022-11-09remove mention of rust-lang#39364 from mpsc docsIbraheem Ahmed-28/+0
2022-11-09add test case for rust-lang#39364Ibraheem Ahmed-0/+14
2022-11-09implement `sync::mpsc` as a wrapper around `sync::mpmc`Ibraheem Ahmed-2798/+24
2022-11-09initial port of crossbeam-channelIbraheem Ahmed-0/+2694
2022-11-09`IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` documentation.Abhijit Gadgil-0/+9
Added documentation for IPv6 Addresses `IN6ADDR_ANY_INIT` also known as `in6addr_any` and `IN6ADDR_LOOPBACK_INIT` also known as `in6addr_loopback` similar to `INADDR_ANY` for IPv4 Addresses.
2022-11-08Test const `Hash`, fix nitsonestacked-1/+1
2022-11-08clarify licensing situation of mpsc and spsc queuePietro Albini-2/+17
2022-11-06Bump version placeholders to releaseMark Rousskov-1/+1
2022-11-06rustdoc: Add an example for round that is different from truncateyancy-0/+4
2022-11-06Added `const_hash` tracking issue idonestacked-3/+3
2022-11-06Made `Sip` const `Hasher`onestacked-3/+7
2022-11-06std: fix double-free of mutexjoboet-1/+1
2022-11-06std: remove lock wrappers in `sys_common`joboet-653/+404
2022-11-05Rollup merge of #103995 - SUPERCILEX:typos, r=Dylan-DPCDylan DPC-7/+8
Small round of typo fixes
2022-11-04Small round of typo fixesAlex Saveau-7/+8
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-01Rollup merge of #103637 - ChrisDenton:stdio-uwp, r=thomccManish Goregaokar-120/+28
Use stdio in UWP apps Fixes #103233 This has been supported since Windows 10.0.16299. See https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-console-l1-1-0dll
2022-11-01Rollup merge of #103809 - tyggja:patch-1, r=JohnTitorDylan DPC-1/+1
Fix a typo in std::net mod doc comment net-doc syntax
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-0/+3
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-31Update mod.rstyggja-1/+1
2022-10-29Add BorrowedBuf::filled_mutAlex Saveau-0/+7
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-10-29Adjust stabilization version to 1.65.0 for wasi fdsMark Rousskov-2/+2
See https://github.com/rust-lang/rust/pull/103308#issuecomment-1292277645 for this ask.
2022-10-29fix typo in hashmap and hashset try_reserve methodjoseLuís-2/+2
2022-10-29More inference-friendly API for lazyAleksey Kladov-4/+7
The signature for new was ``` fn new<F>(f: F) -> Lazy<T, F> ``` Notably, with `F` unconstrained, `T` can be literally anything, and just `let _ = Lazy::new(|| 92)` would not typecheck. This historiacally was a necessity -- `new` is a `const` function, it couldn't have any bounds. Today though, we can move `new` under the `F: FnOnce() -> T` bound, which gives the compiler enough data to infer the type of T from closure.
2022-10-27Use stdio in UWP appsChris Denton-120/+28
This has been supported since Windows 10.0.16299. See https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-core-console-l1-1-0dll
2022-10-27Rollup merge of #103564 - RalfJung:miri-unused, r=thomccMatthias Krüger-2/+3
library: allow some unused things in Miri Should help for https://github.com/rust-lang/rust/pull/102950.
2022-10-27Rollup merge of #103596 - RalfJung:thread-setname, r=cuviperYuki Okushi-6/+10
thread::set_name: debug-assert that things went well r? `@cuviper`
2022-10-26thread::set_name: debug-assert that things went wellRalf Jung-6/+10
2022-10-26library: allow some unused things in MiriRalf Jung-2/+3
2022-10-25more dupe typos againRageking8-1/+1
2022-10-25Rollup merge of #103379 - cuviper:truncate-thread-name, r=thomccDylan DPC-0/+49
Truncate thread names on Linux and Apple targets These targets have system limits on the thread names, 16 and 64 bytes respectively, and `pthread_setname_np` returns an error if the name is longer. However, we're not in a context that can propagate errors when we call this, and we used to implicitly truncate on Linux with `prctl`, so now we manually truncate these names ahead of time. r? ``````@thomcc``````