about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2021-04-29Ignore doctests in bootstrapest31-1/+2
On bootstrap the IntoIterator trait is not implemented yet for arrays.
2021-04-28Rollup merge of #84663 - CDirkx:dropguard, r=Mark-SimulacrumJack Huey-24/+4
Remove `DropGuard` in `sys::windows::process` and use `StaticMutex` instead `StaticMutex` is a mutex that when locked provides a guard that unlocks the mutex again when dropped, thus provides the exact same functionality as `DropGuard`. `StaticMutex` is used in more places, and is thus preferred over an ad-hoc construct like `DropGuard`. ````@rustbot```` label: +T-libs-impl
2021-04-28Auto merge of #84615 - a1phyr:clone_from_pathbuf_osstring, r=Mark-Simulacrumbors-3/+39
Override `clone_from` method for PathBuf and OsString This was not the case before because `#[derive(Clone)]` do not do it.
2021-04-28Auto merge of #84650 - a1phyr:simplify_mutex_into_inner, r=m-ou-sebors-19/+2
Simplify `Mutex::into_inner` Thanks to #77147, `Mutex` do not implement `Drop` directly, so the old unsafe implementation of `into_inner` is not relevant anymore.
2021-04-28Remove `DropGuard` in `sys::windows::process` and use `StaticMutex` insteadChristiaan Dirkx-24/+4
2021-04-28Fix missing import in `unsupported::args`Christiaan Dirkx-0/+1
2021-04-28Reuse `unsupported::args` on `wasm`Christiaan Dirkx-42/+1
2021-04-28Move `wasm` atomics code to `wasm/atomics`Christiaan Dirkx-5/+5
2021-04-28Rework `wasm::thread` to `thread_atomics`Christiaan Dirkx-19/+8
2021-04-28Reuse `unix::cmath`Christiaan Dirkx-118/+34
2021-04-28Simplify `Mutex::into_inner`Benoît du Garreau-19/+2
2021-04-28Rollup merge of #84624 - r00ster91:patch-5, r=JohnTitorYuki Okushi-1/+1
Make sentence in env::args_os' docs plain and simple Follow-up to #84551. See https://github.com/rust-lang/rust/pull/84551#discussion_r620728070 on why this makes more sense.
2021-04-28Add a paragraph with possible alternatives on older editionsest31-0/+42
2021-04-27Make sentence in env::args_os' docs plain and simpler00ster-1/+1
2021-04-27Update library/std/src/sys/unix/thread.rsAlik Aslanyan-1/+1
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-04-27Rollup merge of #84521 - CDirkx:hermit-dedup, r=Mark-SimulacrumDylan DPC-92/+3
Reuse modules on `hermit` Reuse the following modules on `hermit`: - `unix::path` (contents identical) - `unsupported::io` (contents identical) - `unsupported::thread_local_key` (contents functionally identical, only changes are the panic error messages) `@rustbot` label: +T-libs-impl
2021-04-27Override `clone_from` method for PathBuf and OsStringBenoît du Garreau-3/+39
2021-04-26Rollup merge of #84551 - r00ster91:patch-4, r=yaahcMara Bos-8/+16
Unify the docs of std::env::{args_os, args} more I noticed that `args_os` was missing some information and I thought it should mention `args` for when you want more safety just like how `args` mentions `args_os` if you don't want it to panic on invalid Unicode.
2021-04-26Point out that behavior might be switched on 2015 and 2018 editions too one dayest31-2/+4
2021-04-26Implement setting thread name for FuchsiaAlik Aslanyan-4/+30
2021-04-25Rollup merge of #84541 - KaiJewson:inline-raw, r=m-ou-seDylan DPC-0/+76
Inline most raw socket, fd and handle conversions Now that file descriptor types on Unix have niches, it is advantageous for user libraries which provide file descriptor wrappers (e.g. `Socket` from socket2) to store a `File` internally instead of a `RawFd`, so that the niche can be taken advantage of. However, doing so will currently result in worse performance as `IntoRawFd`, `FromRawFd` and `AsRawFd` are not inlined. This change adds `#[inline]` to those methods on std types that wrap file descriptors, handles or sockets.
2021-04-25Change wordingr00ster-2/+2
2021-04-25Unify the docs of std::env::{args_os, args} morer00ster-8/+16
2021-04-25Auto merge of #84216 - RalfJung:black-box, r=Mark-Simulacrumbors-0/+1
move core::hint::black_box under its own feature gate The `black_box` function had its own RFC and is tracked separately from the `test` feature at https://github.com/rust-lang/rust/issues/64102. Let's reflect this in the feature gate. To avoid breaking all the benchmarks, libtest's `test::black_box` is a wrapping definition, not a reexport -- this means it is still under the `test` feature gate.
2021-04-25move core::hint::black_box under its own feature gateRalf Jung-0/+1
2021-04-25Auto merge of #84147 - cuviper:array-method-dispatch, r=nikomatsakis,m-ou-sebors-20/+57
Cautiously add IntoIterator for arrays by value Add the attribute described in #84133, `#[rustc_skip_array_during_method_dispatch]`, which effectively hides a trait from method dispatch when the receiver type is an array. Then cherry-pick `IntoIterator for [T; N]` from #65819 and gate it with that attribute. Arrays can now be used as `IntoIterator` normally, but `array.into_iter()` has edition-dependent behavior, returning `slice::Iter` for 2015 and 2018 editions, or `array::IntoIter` for 2021 and later. r? `@nikomatsakis` cc `@LukasKalbertodt` `@rust-lang/libs`
2021-04-25Inline most raw socket, fd and handle conversionsKaiJewson-0/+76
2021-04-24Ignore array IntoIterator tests in bootstrapJosh Stone-2/+4
2021-04-25Auto merge of #84115 - CDirkx:rt, r=m-ou-sebors-262/+175
Rework `init` and `cleanup` This PR reworks the code in `std` that runs before and after `main` and centralizes this code respectively in the functions `init` and `cleanup` in both `sys_common` and `sys`. This makes is easy to see what code is executed during initialization and cleanup on each platform just by looking at e.g. `sys::windows::init`. Full list of changes: - new module `rt` in `sys_common` to contain `init` and `cleanup` and the runtime macros. - `at_exit` and the mechanism to register exit handlers has been completely removed. In practice this was only used for closing sockets on windows and flushing stdout, which have been moved to `cleanup`. - <s>On windows `alloc` and `net` initialization is now done in `init`, this saves a runtime check in every allocation and network use.</s>
2021-04-25Rollup merge of #84179 - CDirkx:dont_send_sync, r=m-ou-seYuki Okushi-27/+30
Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}` Remove the field `_dont_send_or_sync_me: PhantomData<*mut ()>` in favor of an explicit implementation of `!Send` and `!Sync`.
2021-04-24Reuse `unix::path` and `unsupported::{io, thread_local_key}` on `hermit`Christiaan Dirkx-92/+3
2021-04-24Rollup merge of #84387 - CDirkx:poison, r=m-ou-seYuki Okushi-14/+15
Move `sys_common::poison` to `sync::poison` `sys_common` should not contain publicly exported types, only platform-independent abstractions on top of `sys`, which `sys_common::poison` is not. There is thus no reason for the module to not live under `sync`. Part of #84187.
2021-04-23Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`Christiaan Dirkx-27/+30
2021-04-22Rollup merge of #84413 - CDirkx:args_inner_debug, r=m-ou-seDylan DPC-32/+27
Remove `sys::args::Args::inner_debug` and use `Debug` instead This removes the method `sys::args::Args::inner_debug` on all platforms and implements `Debug` for `Args` instead. I believe this creates a more natural API for the different platforms under `sys`: export a type `Args: Debug + Iterator + ...` vs. `Args: Iterator + ...` and with a method `inner_debug`.
2021-04-22Rollup merge of #84402 - CDirkx:rwlock, r=dtolnayDylan DPC-60/+53
Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock` This moves `sys_common::rwlock::StaticRwLock`, `RWLockReadGuard` and `RWLockWriteGuard` to `sys::unix::rwlock`. They are already `#[cfg(unix)]` and don't need to be in `sys_common`.
2021-04-22Remove `Once` from `init`Christiaan Dirkx-6/+10
2021-04-22Document that `init` and `cleanup` are not guaranteed to runChristiaan Dirkx-2/+13
2021-04-22Apply suggestions from reviewChristiaan Dirkx-9/+12
2021-04-22Move most init to `sys::init`Christiaan Dirkx-57/+31
2021-04-22Remove `sys::args::Args::inner_debug` and use `Debug` insteadChristiaan Dirkx-32/+27
2021-04-22Move all cleanup to `sys::cleanup`Christiaan Dirkx-24/+7
2021-04-22Rework `at_exit` to `cleanup`Christiaan Dirkx-196/+134
2021-04-22Move `sys_common::poison` to `sync::poison`Christiaan Dirkx-14/+15
2021-04-21Ensure TLS destructors run before thread joins in SGXMohsen Zohrevandi-11/+119
2021-04-21Rollup merge of #84212 - CDirkx:void, r=m-ou-seMara Bos-252/+238
Replace `Void` in `sys` with never type This PR replaces several occurrences in `sys` of the type `enum Void {}` with the Rust never type (`!`). The name `Void` is unfortunate because in other languages (C etc.) it refers to a unit type, not an uninhabited type. Note that the previous stabilization of the never type was reverted, however all uses here are implementation details and not publicly visible.
2021-04-21Rollup merge of #84119 - CDirkx:vxworks, r=m-ou-seMara Bos-222/+88
Move `sys::vxworks` code to `sys::unix` Follow-up to #77666, `sys::vxworks` is almost identical to `sys::unix`, the only differences are the `rand`, `thread_local_dtor`, and `process` implementation. Since `vxworks` is `target_family = unix` anyway, there is no reason for the code not to live inside of `sys::unix` like all the other unix-OSes. https://github.com/rust-lang/rust/blob/e41f378f825488a537b024fc3ed599d9c12fda96/compiler/rustc_target/src/spec/vxworks_base.rs#L12 ``@rustbot`` label: +T-libs-impl
2021-04-21Rollup merge of #84013 - CDirkx:fmt, r=m-ou-seMara Bos-29/+29
Replace all `fmt.pad` with `debug_struct` This replaces any occurrence of: - `f.pad("X")` with `f.debug_struct("X").finish()` - `f.pad("X { .. }")` with `f.debug_struct("X").finish_non_exhaustive()` This is in line with existing formatting code such as https://github.com/rust-lang/rust/blob/125505306744a0a5bb01d62337260a95d9ff8d57/library/std/src/sync/mpsc/mod.rs#L1470-L1475
2021-04-21Move `sys_common::rwlock::StaticRWLock` etc. to `sys::unix::rwlock`Christiaan Dirkx-60/+53
2021-04-21Apply suggestions from code reviewChristiaan Dirkx-2/+4
2021-04-21Replace all `fmt.pad` with `debug_struct`Christiaan Dirkx-29/+29