about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2021-02-15Rollup merge of #82063 - NULLx76:fix-minor-typo, r=jonas-schievinkJonas Schievink-1/+1
Fixed minor typo in catch_unwind docs Changed "a an exception" to "an exception" inside of the `std::panic::catch_unwind` docs.
2021-02-15Rollup merge of #81975 - Amanieu:seal2, r=m-ou-seJonas Schievink-30/+54
Seal the CommandExt, OsStrExt and OsStringExt traits A crater run (https://github.com/rust-lang/rust/pull/81213#issuecomment-767651811) has shown that this does not break any existing code. This also unblocks #77728. Based on #81213. r? ````@m-ou-se```` cc ````@lygstate````
2021-02-15Fix intra-doc link to raw pointer methodSimon Sapin-0/+1
CC https://github.com/rust-lang/rust/pull/80181
2021-02-15add diagnostic itemsAndrea Nall-0/+2
Add diagnostic items to the following types: OsString (os_string_type) PathBuf (path_buf_type) Owned (to_owned_trait) As well as the to_vec method on slice/[T]
2021-02-14Implement Extend and FromIterator for OsStringRyan Lopopolo-0/+45
Add the following trait impls: - `impl Extend<OsString> for OsString` - `impl<'a> Extend<&'a OsStr> for OsString` - `impl FromIterator<OsString> for OsString` - `impl<'a> FromIterator<&'a OsStr> for OsString` Because `OsString` is a platform string with no particular semantics, concatenating them together seems acceptable.
2021-02-14Stabilize Arguments::as_strSteven Fackler-1/+0
Closes #74442
2021-02-14Fix typo in link to CreateSymbolicLinkW documentation.Mara Bos-1/+1
2021-02-13Fixed minor typo in catch_unwind docsVictor Roest-1/+1
Changed 'a an exception' to 'an exception'
2021-02-12Rollup merge of #81850 - the8472:env-rwlock, r=m-ou-seDylan DPC-12/+72
use RWlock when accessing os::env Multiple threads modifying the current process environment is fairly uncommon. Optimize for the more common read case. r? ````@m-ou-se````
2021-02-10Make WASI's `hard_link` behavior match other platforms.Dan Gohman-1/+2
Following #78026, `std::fs::hard_link` on most platforms does not follow symlinks. Change the WASI implementation to also not follow symlinks.
2021-02-10Seal the CommandExt, OsStrExt and OsStringExt traitsAmanieu d'Antras-30/+54
2021-02-09Stabilize str_split_onceJacob Pratt-1/+0
2021-02-10Rollup merge of #79849 - Digital-Chaos:sleep-zero, r=m-ou-seYuki Okushi-0/+9
Clarify docs regarding sleep of zero duration Clarify that the behaviour of sleep() when given a duration of zero is actually platform specific.
2021-02-09split guard into read and write typesThe8472-17/+16
2021-02-08introduce StaticRWLock wrapper to make methods safeThe8472-60/+72
2021-02-08avoid &mut on the read path since it now allows concurrent readersThe8472-1/+1
2021-02-08Remove outdated comment.Mara Bos-2/+0
2021-02-07expand/resolve: Turn `#[derive]` into a regular macro attributeVadim Petrochenkov-0/+5
2021-02-07silence dead code warnings on windowsThe8472-0/+5
2021-02-07use rwlock for accessing ENVThe8472-11/+55
2021-02-07Auto merge of #81821 - nikic:update-wasm32, r=sanxiynbors-0/+5
Upgrade wasm32 image to Ubuntu 20.04 This switches the wasm32 image, which is used to test wasm32-unknown-emscripten, to Ubuntu 20.04. While at it, enable most of the excluded tests, as they seem to work fine with some minor fixes.
2021-02-06Added `try_exists()` method to `std::path::Path`Martin Habovstiak-0/+30
This method is similar to the existing `exists()` method, except it doesn't silently ignore the errors, leading to less error-prone code. This change intentionally does NOT touch the documentation of `exists()` nor recommend people to use this method while it's unstable. Such changes are reserved for stabilization to prevent confusing people. Apart from that it avoids conflicts with #80979.
2021-02-06Upgrade wasm32 image to Ubuntu 20.04Nikita Popov-0/+5
This switches the wasm32 image, which is used to test wasm32-unknown-emscripten to Ubuntu 20.04. While at it, enable most of the excluded tests, as they seem to work fine with some minor fixes.
2021-02-05Rollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichtonMara Bos-0/+8
Expose correct symlink API on WASI As described in https://github.com/rust-lang/rust/issues/68574, the currently exposed API for symlinks is, in fact, a thin wrapper around the corresponding syscall, and not suitable for public usage. The reason is that the 2nd param in the call is expected to be a handle of a "preopened directory" (a WASI concept for exposing dirs), and the only way to retrieve such handle right now is by tinkering with a private `__wasilibc_find_relpath` API, which is an implementation detail and definitely not something we want users to call directly. Making matters worse, the semantics of this param aren't obvious from its name (`fd`), and easy to misinterpret, resulting in people trying to pass a handle of the target file itself (as in https://github.com/vitiral/path_abs/pull/50), which doesn't work as expected. I did a [codesearch among open-source repos](https://sourcegraph.com/search?q=std%3A%3Aos%3A%3Awasi%3A%3Afs%3A%3Asymlink&patternType=literal), and the usage above is so far the only usage of this API at all, but we should fix it before more people start using it incorrectly. While this is technically a breaking API change, I believe it's a justified one, as 1) it's OS-specific and 2) there was strictly no way to correctly use the previous form of the API, and if someone does use it, they're likely doing it wrong like in the example above. The new API does not lead to the same confusion, as it mirrors `std::os::unix::fs::symlink` and `std::os::windows::fs::symlink_{file,dir}` variants by accepting source/target paths. Fixes #68574. r? ``@alexcrichton``
2021-02-04Rollup merge of #81745 - Kixunil:stabilize_once_poison, r=m-ou-seMara Bos-15/+9
Stabilize poison API of Once, rename poisoned() This stabilizes: * `OnceState` * `OnceState::is_poisoned()` (previously named `poisoned()`) * `Once::call_once_force()` `poisoned()` was renamed because the new name is more clear as a few people agreed and nobody objected. Closes #33577 Notes: * I'm not entirely sure it's supposed to be 1.51, LMK if I did it wrong * I failed to run tests locally, so we will have to leave it to bors or someone else can try
2021-02-04Rollup merge of #81711 - saethlin:ipaddr-inline, r=m-ou-seMara Bos-0/+69
add #[inline] to all the public IpAddr functions
2021-02-04Rollup merge of #81710 - TyPR124:patch-2, r=m-ou-seMara Bos-1/+1
OsStr eq_ignore_ascii_case takes arg by value Per a comment on #70516 this changes `eq_ignore_ascii_case` to take the generic parameter `S: AsRef<OsStr>` by value instead of by reference. This is technically a breaking change to an unstable method. I think the only way it would break is if you called this method with an explicit type parameter, ie `my_os_str.eq_ignore_ascii_case::<str>("foo")` becomes `my_os_str.eq_ignore_ascii_case::<&str>("foo")`. Besides that, I believe it is overall more flexible since it can now take an owned `OsString` for example. If this change should be made in some other PR (like #80193) then please just close this.
2021-02-04Stabilize poison API of Once, rename poisoned()Martin Habovstiak-15/+9
This stabilizes: * `OnceState` * `OnceState::is_poisoned()` (previously named `poisoned()`) * `Once::call_once_force()` `poisoned()` was renamed because the new name is more clear as a few people agreed and nobody objected. Closes #33577
2021-02-03Stabilize the Wake traitYoshua Wuyts-2/+1
Co-Authored-By: Ashley Mannix <kodraus@hey.com>
2021-02-03add #[inline] to all the public IpAddr functionsBen Kimock-0/+69
2021-02-03Restore comment as it wasIngvar Stepanyan-0/+2
2021-02-03Keep old symlink; expose new symlink_pathIngvar Stepanyan-4/+14
2021-02-03OsStr eq_ignore_ascii_case takes arg by valueTyler Ruckinger-1/+1
Per a comment on #70516 this changes `eq_ignore_ascii_case` to take the generic parameter `S: AsRef<OsStr>` by value instead of by reference. This is technically a breaking change to an unstable method. I think the only way it would break is if you called this method with an explicit type parameter, ie `my_os_str.eq_ignore_ascii_case::<str>("foo")` becomes `my_os_str.eq_ignore_ascii_case::<&str>("foo")`. Besides that, I believe it is overall more flexible since it can now take an owned `OsString` for example. If this change should be made in some other PR (like #80193) then please just close this.
2021-02-02Rollup merge of #81588 - xfix:delete-doc-alias, r=Mark-SimulacrumJack Huey-0/+5
Add doc aliases for "delete" This patch adds doc aliases for "delete". The added aliases are supposed to reference usages `delete` in other programming languages. - `HashMap::remove`, `BTreeMap::remove` -> `Map#delete` and `delete` keyword in JavaScript. - `HashSet::remove`, `BTreeSet::remove` -> `Set#delete` in JavaScript. - `mem::drop` -> `delete` keyword in C++. - `fs::remove_file`, `fs::remove_dir`, `fs::remove_dir_all`-> `File#delete` in Java, `File#delete` and `Dir#delete` in Ruby. Before this change, searching for "delete" in documentation returned no results.
2021-02-02Rollup merge of #81530 - ojeda:sys-use-abort-instead-of-wasm32-unreachable, ↵Jack Huey-1/+1
r=Mark-Simulacrum sys: use `process::abort()` instead of `arch::wasm32::unreachable()` Rationale: - `abort()` lowers to `wasm32::unreachable()` anyway. - `abort()` isn't `unsafe`. - `abort()` matches the comment better. - `abort()` avoids confusion by future readers (e.g. https://github.com/rust-lang/rust/pull/81527): the naming of wasm's `unreachable` instruction is a bit unfortunate because it is not related to the `unreachable()` intrinsic (intended to trigger UB). Codegen is likely to be different since `unreachable()` is `inline` while `abort()` is `cold`. Since it doesn't look like we are expecting here to trigger this case, the latter seems better anyway.
2021-02-02Rollup merge of #81455 - Amanieu:aarch64_ilp32, r=sanxiynJack Huey-8/+8
Add AArch64 big-endian and ILP32 targets This PR adds 3 new AArch64 targets: - `aarch64_be-unknown-linux-gnu` - `aarch64-unknown-linux-gnu_ilp32` - `aarch64_be-unknown-linux-gnu_ilp32` It also fixes some ABI issues on big-endian ARM and AArch64.
2021-02-02Rollup merge of #81022 - seanchen1991:feat/frames-iter, r=KodrAusJonas Schievink-38/+92
Add Frames Iterator for Backtrace Second attempt at adding the ability to iterate over the frames of a Backtrace by exposing the frames method.
2021-02-02Fix AArch64 types in std::os::rawAmanieu d'Antras-8/+8
2021-02-01Rollup merge of #81598 - sivadeilra:windows_dll_imports_fix_x86, r=m-ou-seJonas Schievink-12/+10
Fix calling convention for CRT startup My PR #81478 used the wrong calling convention for a set of functions that are called by the CRT. These functions need to use `extern "C"`. This would only affect x86, which is the only target (that I know of) that has multiple calling conventions. ```@bors``` r? ```@m-ou-se```
2021-02-01Rollup merge of #78641 - the8472:buffered-copy, r=sfacklerJonas Schievink-8/+138
Let io::copy reuse BufWriter buffers This optimization will allow users to implicitly set the buffer size for io::copy by wrapping the writer into a `BufWriter` if the default block size is insufficient, which should fix #49921 Due to min_specialization limitations this approach only works with `BufWriter` but not for `BufReader<R>` since `R` is unconstrained and thus the necessary specialization on `R: Read` is not always applicable. Once specialization becomes more powerful this optimization could be extended to look at the reader and writer side and use whichever buffer is larger.
2021-02-01Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkovbors-0/+38
Implement Rust 2021 panic This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007. It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller. This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: https://github.com/rust-lang/rust/pull/80879/commits/c5273bdfb266c35e8eab9413aa8d58d27fdbe114 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.
2021-01-31Fix calling convention for CRT startupArlie Davis-12/+10
My PR #81478 used the wrong calling convention for a set of functions that are called by the CRT. These functions need to use `extern "C"`. This would only affect x86, which is the only target (that I know of) that has multiple calling conventions.
2021-01-31Rollup merge of #81549 - est31:wording_fix, r=jonas-schievinkJonas Schievink-7/+7
Misc ip documentation fixes
2021-01-31specialize io::copy to use the memory of the writer if it is a BufWriterThe8472-8/+138
2021-01-31Fix line length formatXavientois-1/+3
2021-01-31Fix formatting on modXavientois-2/+1
2021-01-31Add space for proper indentationXavientois-1/+1
2021-01-31Remove trailing newlineXavientois-2/+3
2021-01-31Add tests for SizeHint implementationsXavientois-2/+29
2021-01-31Implement SizeHint trait for BufReader, Emtpy, and ChainXavientois-8/+29