about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2022-10-04Auto merge of #101768 - sunfishcode:sunfishcode/wasi-stdio-lock-asfd, ↵bors-0/+27
r=joshtriplett Add `AsFd` implementations for stdio lock types on WASI. 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-10-04fix backtrace small typoRageking8-3/+3
2022-10-03Reduce CString allocations in std as much as possibleAlex Saveau-286/+394
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-10-03Reword "has no meaning" per suggestionTim-2/+2
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-10-03Add SAFETY comments for AsFd implementations on stdin/stdout/stderrJosh Triplett-0/+3
2022-10-03Add stability attributes.Dan Gohman-3/+6
2022-10-03scoped threads: pass closure through MaybeUninit to avoid invalid dangling ↵Ralf Jung-0/+33
references
2022-10-02Auto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-sebors-1/+1
Change `is_some_and` to take by value Consistent with other function-accepting `Option` methods. Tracking issue: #93050 r? `@m-ou-se`
2022-10-02Make Hash{Set,Map}::with_hasher unstably constNixon Enraght-Moony-2/+17
2022-10-02Rollup merge of #102313 - anirudh24seven:update_sleep_ms_doc, r=Mark-SimulacrumMatthias Krüger-0/+2
Update docs so that deprecated method points to relevant method The docs for the deprecated 'park_timeout_ms' method suggests that the user 'use park_timeout' method instead (at https://doc.rust-lang.org/std/thread/index.html). Making a similar change so that the docs for the deprecated `sleep_ms` method suggest that the user `use sleep` method instead.
2022-10-01Change feature name to is_some_andCameron Steffen-1/+1
2022-10-01`SetFileTime` doesn't allow setting the file time to `0xFFFF_FFFF_FFFF_FFFF`beetrees-0/+8
2022-10-01Error instead of panicking when setting file times if the passed ↵beetrees-49/+37
`SystemTime` doesn't fit into the required type
2022-09-30Standard library OS support for Apple WatchOSVladimir Michael Eatwell-0/+235
2022-09-29unsafe keyword: trait examples and unsafe_op_in_unsafe_fn updateRalf Jung-32/+120
2022-09-29Stabilize `nonnull_slice_from_raw_parts`Yuki Okushi-1/+0
2022-09-29Rollup merge of #102433 - RalfJung:temp-dir-typo, r=thomccYuki Okushi-1/+1
env::temp_dir: fix a typo
2022-09-29Rollup merge of #102368 - beetrees:nano-niche, r=joshtriplettYuki Okushi-13/+21
Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant` As the nanoseconds fields is always between `0` and `(NANOS_PER_SEC - 1)` inclusive, use the `rustc_layout_scalar_valid_range` attributes to create a niche in the nanosecond field of `Duration` and `Timespec` (which is used to implement unix `SystemTime` and non-apple unix `Instant`; windows `Instant` is implemented with `Duration` and therefore will also benefit). This change has the benefit of making `Option<T>` the same size as `T` for the previously mentioned types. Also shrinks the nanoseconds field of `Timespec` to a `u32` as nanoseconds do not need the extra range of an `i64`, shrinking `Timespec` by 4 bytes on 32-bit platforms. r? ```@joshtriplett```
2022-09-29Rollup merge of #98368 - sunfishcode:sunfishcode/std-os-fd, r=joshtriplettYuki Okushi-46/+26
Make `std::os::fd` public. `std::os::fd` defines types like `OwnedFd` and `RawFd` and is common between Unix and non-Unix platforms that share a basic file-descriptor concept. Rust currently uses this internally to simplify its own code, but it would be useful for external users in the same way, so make it public. This means that `OwnedFd` etc. will all appear in three places, for example on unix platforms: - `std::os::fd::OwnedFd` - `std::os::unix::io::OwnedFd` - `std::os::unix::prelude::OwnedFd` r? `````@joshtriplett`````
2022-09-28env::temp_dir: fix a typoRalf Jung-1/+1
2022-09-28Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`beetrees-13/+21
2022-09-28std: never panic in `thread::park` and `thread::park_timeout`joboet-2/+20
2022-09-28Rollup merge of #102288 - mejrs:inner, r=compiler-errorsYuki Okushi-0/+2
Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`. This suggests various ways to get inside wrapper types if the method cannot be found on the wrapper type, but is present on the wrappee. For this PR, those wrapper types include `Localkey`, `MaybeUninit`, `RefCell`, `RwLock` and `Mutex`.
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.