about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2021-05-05Rollup merge of #84709 - joshtriplett:doc-alias-chdir, r=dtolnayRalf Jung-0/+1
Add doc alias for `chdir` to `std::env::set_current_dir` Searching for `chdir` in the Rust documentation produces no useful results. I wrote some code recently that called `libc::chdir` and manually handled errors, because I didn't realize that the safe `std::env::set_current_dir` existed. I searched for `chdir` and `change_dir` and `change_directory` (the latter two based on the precedent of unabbreviating set by `create_dir`), and I also read through `std::fs` expecting to potentially find it there. Given that none of those led to `std::env::set_current_dir`, I think that provides sufficient justification to add this specific alias.
2021-05-05Rollup merge of #83553 - jfrimmel:addr-of, r=m-ou-seRalf Jung-1/+21
Update `ptr` docs with regards to `ptr::addr_of!` This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing undefined behavior, which is not necessary anymore. Technically there is now wrong/outdated documentation on stable, but I don't think this is worth a point release 😉 Fixes #83509. ``````````@rustbot`````````` modify labels: T-doc
2021-05-05Bump map_into_keys_values stable version to 1.54.0.Mara Bos-12/+12
2021-05-05Auto merge of #84200 - CDirkx:os, r=m-ou-sebors-190/+161
Move all `sys::ext` modules to `os` This PR moves all `sys::ext` modules to `os`, centralizing the location of all `os` code and simplifying the dependencies between `os` and `sys`. Because this also removes all uses `cfg_if!` on publicly exported items, where after #81969 there were still a few left, this should properly work around https://github.com/rust-analyzer/rust-analyzer/issues/6038. `@rustbot` label: +T-libs-impl
2021-05-03Update `ptr` docs with regards to `ptr::addr_of!`Julian Frimmel-1/+21
This updates the documentation since `ptr::addr_of!` and `ptr::addr_of_mut!` are now stable. One might remove the distinction between the sections `# On packed structs` and `# Examples`, as the old section on packed structs was primarily to prevent users of doing unde- fined behavior, which is not necessary anymore. There is also a new section in "how to obtain a pointer", which referen- ces the `ptr::addr_of!` macros. This commit contains squashed commits from code review. Co-authored-by: Joshua Nelson <joshua@yottadb.com> Co-authored-by: Mara Bos <m-ou.se@m-ou.se> Co-authored-by: Soveu <marx.tomasz@gmail.com> Co-authored-by: Ralf Jung <post@ralfj.de>
2021-05-03Allow documenting on `hermit`Christiaan Dirkx-3/+0
2021-05-03Rework `os` to avoid using `cfg_if!` with public itemsChristiaan Dirkx-123/+151
2021-05-03Move `std::sys::sgx::ext` to `std::os::fortanix_sgx`Christiaan Dirkx-8/+4
2021-05-03Move `std::sys::wasi::ext` to `std::os::wasi`Christiaan Dirkx-26/+2
2021-05-03Move `std::sys::unix::ext` to `std::os::unix`Christiaan Dirkx-22/+2
2021-05-03Move `std::sys::windows::ext` to `std::os::windows`Christiaan Dirkx-16/+5
2021-05-03Move `std::sys::hermit::ext` to `std::os::hermit`Christiaan Dirkx-3/+6
2021-05-03Cleanup `std::os`Christiaan Dirkx-111/+113
2021-05-03Rollup merge of #84856 - kornelski:enomem, r=JohnTitorGuillaume Gomez-1/+1
Correct stability of ErrorKind::OutOfMemory Fix for #84744
2021-05-03Rollup merge of #84835 - wcampbell0x2a:add-issue-34202-link, r=m-ou-seGuillaume Gomez-1/+3
Add link to Issue #34202 in udp docs
2021-05-03Correct stability of ErrorKind::OutOfMemoryKornel-1/+1
2021-05-03Auto merge of #84842 - blkerby:null_lowercase, r=joshtriplettbors-7/+7
Replace 'NULL' with 'null' This replaces occurrences of "NULL" with "null" in docs, comments, and compiler error/lint messages. This is for the sake of consistency, as the lowercase "null" is already the dominant form in Rust. The all-caps NULL looks like the C macro (or SQL keyword), which seems out of place in a Rust context, given that NULL does not exist in the Rust language or standard library (instead having [`ptr::null()`](https://doc.rust-lang.org/stable/std/ptr/fn.null.html)).
2021-05-02Change 'NULL' to 'null'Brent Kerby-7/+7
2021-05-02Add link to Issue #34202 in udp docswcampbell-1/+3
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
2021-05-02Use ErrorKind::OutOfMemory in unix, windows, and wasiKornel-0/+5
2021-05-02Add ErrorKind::OutOfMemoryKornel-0/+6
2021-05-01Auto merge of #84658 - Amanieu:reserved_regs, r=petrochenkovbors-2/+8
Be stricter about rejecting LLVM reserved registers in asm! LLVM will silently produce incorrect code if these registers are used as operands. cc `@rust-lang/wg-inline-asm`
2021-05-01Reserve x18 on AArch64 and un-reserve x16Amanieu d'Antras-4/+4
2021-04-30Avoid using rbx in SGX inline assembly since it is reservedAmanieu d'Antras-2/+8
2021-04-30Auto merge of #84716 - joshtriplett:chroot, r=dtolnaybors-0/+33
Add std::os::unix::fs::chroot to change the root directory of the current process This is a straightforward wrapper that uses the existing helpers for C string handling and errno handling. Having this available is convenient for UNIX utility programs written in Rust, and avoids having to call the unsafe `libc::chroot` directly and handle errors manually, in a program that may otherwise be entirely safe code.
2021-04-30Auto merge of #84522 - CDirkx:cmath, r=yaahcbors-118/+34
Reuse `sys::unix::cmath` on other platforms Reuse `sys::unix::cmath` on all non-`windows` platforms. `unix` is chosen as the canonical location instead of `unsupported` or `common` because `unsupported` doesn't make sense semantically and `common` is reserved for code that is supported on all platforms. Also `unix` is already the home of some non-`windows` code that is technically not exclusive to `unix` like `unix::path`.
2021-04-30Add std::os::unix::fs::chroot to change the root directory of the current ↵Josh Triplett-0/+33
process This is a straightforward wrapper that uses the existing helpers for C string handling and errno handling. Having this available is convenient for UNIX utility programs written in Rust, and avoids having to call the unsafe `libc::chroot` directly and handle errors manually, in a program that may otherwise be entirely safe code.
2021-04-29Rollup merge of #84692 - r00ster91:var-var_os-vars, r=joshtriplettJack Huey-2/+11
Link between std::env::{var, var_os} and std::env::{vars, vars_os} In #84551 I linked between `std::env::{args, args_os}` and this PR does the same but for `std::env::{var, var_os}` and `std::env::{vars, vars_os}`. Now all of `std::env::{var, var_os, vars, vars_os, args, args_os}` should each mention their `_os` or non-`_os` equivalent in the docs so that you can easily navigate between them.
2021-04-29Rollup merge of #84590 - est31:array_into_iter, r=nikomatsakisJack Huey-2/+47
Point out that behavior might be switched on 2015 and 2018 too one day Reword documentation to make it clear that behaviour can be switched on older editions too, one day in the future. It doesn't *have* to be switched, but I think it's good to have it as an option and re-evaluate it a few months/years down the line when e.g. the crates that showed up in crater were broken by different changes in the language already. cc #25725, #65819, #66145, #84147 , and https://github.com/rust-lang/rust/issues/84133#issuecomment-818005314
2021-04-29Simplify chdir implementation and minimize unsafe blockJosh Triplett-5/+3
2021-04-29Add doc alias for `chdir` to `std::env::set_current_dir`Josh Triplett-0/+1
Searching for `chdir` in the Rust documentation produces no useful results.
2021-04-29Use atomics in join_orders_after_tls_destructors testMohsen Zohrevandi-34/+88
std::sync::mpsc uses thread locals and depending on the order TLS dtors are run `rx.recv()` can panic when used in a TLS dtor.
2021-04-29Link between std::env::{var, var_os} and std::env::{vars, vars_os}r00ster91-2/+11
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