about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2022-09-28Rollup merge of #102232 - Urgau:stabilize-bench_black_box, r=TaKO8KiYuki Okushi-1/+0
Stabilize bench_black_box This PR stabilize `feature(bench_black_box)`. ```rust pub fn black_box<T>(dummy: T) -> T; ``` The FCP was completed in https://github.com/rust-lang/rust/issues/64102. `@rustbot` label +T-libs-api -T-libs
2022-09-27Rollup merge of #101555 - jhpratt:stabilize-mixed_integer_ops, r=joshtriplettMatthias Krüger-1/+0
Stabilize `#![feature(mixed_integer_ops)]` Tracked and FCP completed in #87840. ````@rustbot```` label +T-libs-api +S-waiting-on-review +relnotes r? rust-lang/t-libs-api
2022-09-27Address feedbackmejrs-1/+2
2022-09-27Wrapper suggestionsmejrs-0/+1
2022-09-27Stabilize bench_black_boxUrgau-1/+0
2022-09-26Update docs so that deprecated method points to relevant methodAnirudh-0/+2
2022-09-26remove cfg(bootstrap)Pietro Albini-1035/+4
2022-09-26replace stabilization placeholdersPietro Albini-14/+14
2022-09-26fs::get_path solarish version.David Carlier-2/+9
2022-09-25Consistently write `RwLock`Martin Geisler-31/+32
Before the documentation sometimes referred to an "rwlock" and sometimes to "`RwLock`".
2022-09-25Auto merge of #99609 - workingjubilee:lossy-unix-strerror, r=thomccbors-1/+3
Recover error strings on Unix from_lossy_utf8 Some language settings can result in unreliable UTF-8 being produced. This can result in failing to emit the error string, panicking instead. from_lossy_utf8 allows us to assume these strings usually will be fine. This fixes rust-lang#99535.
2022-09-25Auto merge of #98457 - japaric:gh98378, r=m-ou-sebors-0/+7
make Condvar, Mutex, RwLock const constructors work with the `unsupported` impl applying this patch locally to the `rust-src` component fixes #98378 however, the solution seems wrong to me because PR #97791 didn't add any `rustc_const_stable` attribute to underlying implementations like `std::sys::unix::futex`, so I must be missing something about how const-stability is checked ... maybe the `restricted_std` feature (gate?) has an effect? fixes #98378 fixes #98293 (probably)
2022-09-24Rollup merge of #100823 - WaffleLapkin:less_offsets, r=scottmcmMatthias Krüger-14/+14
Refactor some `std` code that works with pointer offstes This PR replaces `pointer::offset` in standard library with `pointer::add` and `pointer::sub`, [re]moving some casts and using `.addr()` while we are at it. This is a more complicated refactor than all other sibling PRs, so take a closer look when reviewing, please 😃 (though I've checked this multiple times and it looks fine). r? ````@scottmcm```` _split off from #100746, continuation of #100822_
2022-09-24Rollup merge of #102188 - flba-eb:doc_missed_at_rename, r=jyn514Matthias Krüger-2/+2
Update doc after renaming `fn is_zero` `fn is_zero` has been renamed to `fn count_is_zero` in 1b1bf2463619e23eba1b36b6d7df276ce73563dd. This patch updates the documentation accordingly.
2022-09-24Rollup merge of #102044 - ChrisDenton:BCrypt-system-rand, r=thomccMatthias Krüger-53/+29
Remove `RtlGenRandom` (take two) First try to use the system preferred RNG but if that fails (e.g. due to a broken system configuration) then fallback to manually opening an algorithm handle.
2022-09-23Update doc after renaming fn is_zeroFlorian Bartels-2/+2
`fn is_zero` has been renamed to `fn count_is_zero` in 1b1bf2463619e23eba1b36b6d7df276ce73563dd. This patch updates the documentation accordingly.
2022-09-23Fix a typo in `std`'s root docsinquisitivecrystal-2/+2
2022-09-22Add `AsFd` implementations for stdio lock types on WASI.Dan Gohman-0/+21
This mirrors the implementations on Unix platforms, and also mirrors the existing `AsRawFd` impls. This is similar to #100892, but is for the `*Lock` types.
2022-09-22Rollup merge of #102036 - Patiga:remove-io-errorkind-other-use-in-std, ↵Dylan DPC-2/+2
r=Mark-Simulacrum Remove use of `io::ErrorKind::Other` in std The documentation states that this `ErrorKind` is not used by the standard library. Instead, `io::ErrorKind::Uncategorized` should be used. The two instances are in the unstable API [linux_pidfd](https://github.com/rust-lang/rust/issues/82971).
2022-09-21Rollup merge of #102058 - mqudsi:path_extension_docs, r=thomccDylan DPC-1/+1
Clarify Path::extension() semantics in docs abstract State up-front and center what shape the returned extension will have, without making the user read through the description and examples. This is a doc-only change. There are no changes to the API contract and the clarification is in line with what was already stated/promised in the existing doc text - just clarified, summarized, and served bright and early. Rationale: Various frameworks and libraries for different platforms have their different conventions as to whether an "extension" is ".ext" or just "ext" and anyone that's had to deal with this ambiguity in the past is always double- or triple-checking to make sure the function call returns an extension that matches the expected semantics. Offer the answer to this important question right off the bat instead of making them dig to find it. ```@rustbot``` label +A-docs
2022-09-20Auto merge of #100581 - joboet:sync_rwlock_everywhere, r=thomccbors-151/+62
std: use `sync::RwLock` for internal statics Since `sync::RwLock` is now `const`-constructible, it can be used for internal statics, removing the need for `sys_common::StaticRwLock`. This adds some extra allocations on platforms which need to box their locks (currently SGX and some UNIX), but these will become unnecessary with the lock improvements tracked in #93740.
2022-09-20Remove `RtlGenRandom` (take two)Chris Denton-53/+29
First try to use the system preferred RNG but if that fails (e.g. due to a broken system configuration) then fallback to manually opening an algorithm handle.
2022-09-20Clarify Path::extension() semantics in docs abstractMahmoud Al-Qudsi-1/+1
State up-front and center what shape the returned extension will have, without making the user read through the description and examples. Rationale: Various frameworks and libraries for different platforms have their different conventions as to whether an "extension" is ".ext" or just "ext" and anyone that's had to deal with this ambiguity in the past is always double- or triple-checking to make sure the function call returns an extension that matches the expected semantics. Offer the answer to this important question right off the bat instead of making them dig to find it.
2022-09-20Add the `#[derive_const]` attributeDeadbeef-0/+4
2022-09-20Remove use of `io::ErrorKind::Other` in stdPatiga-2/+2
The documentation states that this `ErrorKind` is not used by the standard library. Instead, `io::ErrorKind::Uncategorized` should be used.
2022-09-19std: use `sync::RwLock` for internal staticsjoboet-151/+62
2022-09-19Rollup merge of #101798 - y86-dev:const_waker, r=lcnrMatthias Krüger-0/+1
Make `from_waker`, `waker` and `from_raw` unstably `const` Make - `Context::from_waker` - `Context::waker` - `Waker::from_raw` `const`. Also added a small test.
2022-09-19Document surprising and dangerous fs::Permissions behaviour on UnixTim Hutt-3/+64
This documents the very surprising behaviour that `set_readonly(false)` will make a file *world writable* on Unix. I would go so far as to say that this function should be deprecated on Unix, or maybe even entirely. But documenting the bad behaviour is a good first step.
2022-09-18Move `unix_socket_abstract` feature API to `SocketAddrExt`.John Millikin-83/+123
2022-09-18Adjust `tcp_quickack` feature to allow other `os::linux::net` features.John Millikin-12/+17
2022-09-17Rollup merge of #101672 - idigdoug:array_try_into, r=Mark-SimulacrumMatthias Krüger-1/+22
array docs - advertise how to get array from slice On my first Rust project, I spent more time than I care to admit figuring out how to efficiently get an array from a slice. Update the array documentation to explain this a bit more clearly. (As a side note, it's a bit unfortunate that get-array-from-slice is only available via trait since that means it can't be used from const functions yet.)
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-15Rollup merge of #101559 - andrewpollack:add-backtrace-off-fuchsia, r=tmandryMatthias Krüger-17/+16
Adding "backtrace off" option for fuchsia targets Used for improving compiler test suite results on Fuchsia targets
2022-09-14Adding backtrace off option for fuchsia targetsAndrew Pollack-17/+16
2022-09-14Made from_waker, waker, from_raw consty86-dev-0/+1
2022-09-12Simplify `clippy` fix.Markus Reiter-2/+0
2022-09-12Add `rustc_diagnostic_item` for IP addresses.Markus Reiter-0/+5
2022-09-12Flatten `net` module again.Markus Reiter-9/+7
2022-09-12Move `net::parser` into `net::addr` module.Markus Reiter-3/+3
2022-09-12Add tests for `SockAddr` `Display`.Markus Reiter-0/+69
2022-09-12Use `DisplayBuffer` for socket addresses.Markus Reiter-46/+34
2022-09-12Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726Dylan DPC-14/+2
Remove manual <[u8]>::escape_ascii `@rustbot` label: +C-cleanup
2022-09-11Auto merge of #101442 - joboet:null_check_tcs, r=thomccbors-2/+6
Check if TCS is a null pointer on SGX The `EENTER` instruction only checks if the TCS is aligned, not if it zero. Saying the address returned is a `NonNull<u8>` (for which `Tcs` is a type alias) is unsound. As well-behaved runners will not put the TCS at address zero, so the definition of `Tcs` is correct. However, `std` should check the address before casting it to a `NonNull`. ping `@jethrogb` `@raoulstrackx` `@rustbot` label I-unsound
2022-09-11std: check if TCS is a null pointerjoboet-2/+6
2022-09-11std: use correct clock in `park_timeout` on Horizonjoboet-2/+4
2022-09-11Auto merge of #101482 - joboet:netbsd_parker, r=sanxiynbors-12/+136
Optimize thread parking on NetBSD As the futex syscall is not present in the latest stable release, NetBSD cannot use the efficient thread parker and locks Linux uses. Currently, it therefore relies on a pthread-based parker, consisting of a mutex and semaphore which protect a state variable. NetBSD however has more efficient syscalls available: [`_lwp_park`](https://man.netbsd.org/_lwp_park.2) and [`_lwp_unpark`](https://man.netbsd.org/_lwp_unpark.2). These already provide the exact semantics of `thread::park` and `Thread::unpark`, but work with thread ids. In `std`, this ID is here stored in an atomic state variable, which is also used to optimize cases were the parking token is already available at the time `thread::park` is called. r? `@m-ou-se`
2022-09-10array docs - advertise how to get array from sliceDoug Cook (WINDOWS)-1/+22
On my first Rust project, I spent more time than I care to admit figuring out how to efficiently get an array from a slice. Update the array documentation to explain this a bit more clearly. (As a side note, it's a bit unfortunate that get-array-from-slice is only available via trait since that means it can't be used from const functions yet.)
2022-09-11Auto merge of #101643 - ChrisDenton:alloc-link-kernel32, r=thomccbors-0/+1
Explicitly link kernel32.lib from alloc
2022-09-10std: optimize thread parking on NetBSDjoboet-12/+136
2022-09-10Rollup merge of #101606 - akhi3030:patch-1, r=Dylan-DPCDylan DPC-1/+1
doc: fix minor typo