Commit Graph

1294 Commits

Author SHA1 Message Date
Dan Gohman 7d5242a03a x.py fmt 2021-02-24 10:58:21 -08:00
Dan Gohman 94e75acf1f Mention "wasi" in the comment about "main modules". 2021-02-24 10:47:26 -08:00
Dan Gohman e66e263544 Make the main `wasi` module `cfg(not(doc))`. 2021-02-24 10:43:50 -08:00
Dan Gohman 0208fca342 Use `super::` to refer to WASI-specific names.
This ensures that these names resolve to the right place even when
building the WASI support on other platforms for generating the
documentation.
2021-02-24 10:37:05 -08:00
Dan Gohman 9ce567efc2 Cast `libc::STDIN_FILENO` to `RawFd`.
WASI's `RawFd` is a `u32`, while `libc` uses `c_int`.
2021-02-24 10:35:40 -08:00
Maarten de Vries f291131f2e Bump minimum libc version to 0.2.85 for std. 2021-02-24 12:47:28 +01:00
Maarten de Vries 3ac62cafa3 Use libc::accept4 on Android instead of raw syscall. 2021-02-24 12:24:36 +01:00
Miguel Ojeda eefec8abda library: Normalize safety-for-unsafe-block comments
Almost all safety comments are of the form `// SAFETY:`,
so normalize the rest and fix a few of them that should
have been a `/// # Safety` section instead.

Furthermore, make `tidy` only allow the uppercase form. While
currently `tidy` only checks `core`, it is a good idea to prevent
`core` from drifting to non-uppercase comments, so that later
we can start checking `alloc` etc. too.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-02-24 06:13:42 +01:00
Eric Huss 476c6c27e7 Update outdated comment in unix Command. 2021-02-23 20:19:15 -08:00
LeSeulArtichaut a6eb836ff0 Use #[doc = include_str!()] in std 2021-02-23 15:54:55 +01:00
Dan Gohman 132ec261b0 Enable API documentation for `std::os::wasi`.
This adds API documentation support for `std::os::wasi` modeled after
how `std::os::unix` works, so that WASI can be documented [here] along
with the other platforms.

[here]: https://doc.rust-lang.org/stable/std/os/index.html

Two changes of particular interest:

 - This changes the `AsRawFd` for `io::Stdin` for WASI to return
   `libc::STDIN_FILENO` instead of `sys::stdio::Stdin.as_raw_fd()` (and
   similar for `Stdout` and `Stderr`), which matches how the `unix`
   version works. `STDIN_FILENO` etc. may not always be explicitly
   reserved at the WASI level, but as long as we have Rust's `std` and
   `libc`, I think it's reasonable to guarantee that we'll always use
   `libc::STDIN_FILENO` for stdin.

 - This duplicates the `osstr2str` utility function, rather than
   trying to share it across all the configurations that need it.
2021-02-23 05:40:08 -08:00
bors cd64446196 Auto merge of #82076 - jyn514:update-bootstrap, r=Mark-Simulacrum
Update the bootstrap compiler

This updates the bootstrap compiler, notably leaving out a change to enable semicolon in macro expressions lint, because stdarch still depends on the old behavior.
2021-02-23 07:19:41 +00:00
Joshua Nelson 68f41b8328 Add more links between hash and btree collections
- Link from `core::hash` to `HashMap` and `HashSet`
- Link from HashMap and HashSet to the module-level documentation on
  when to use the collection
- Link from several collections to Wikipedia articles on the general
  concept
2021-02-23 00:41:41 -05:00
Dylan DPC b8d4354099
Rollup merge of #82128 - anall:feature/add_diagnostic_items, r=davidtwco
add diagnostic items for OsString/PathBuf/Owned as well as to_vec on slice

This is adding diagnostic items to be used by rust-lang/rust-clippy#6730, but my understanding is the clippy-side change does need to be done over there since I am adding a new clippy feature.

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-23 02:51:51 +01:00
Dylan DPC 7b9ef2fde4
Rollup merge of #81984 - sunfishcode:wasi-link, r=alexcrichton
Make WASI's `hard_link` behavior match other platforms.

Following #78026, `std::fs::hard_link` on most platforms does not follow
symlinks. Change the WASI implementation to also not follow symlinks.

r? ```@alexcrichton```
2021-02-23 02:51:49 +01:00
Ian Jackson 4bb8425af6 ExitStatus: Improve documentation re wait status vs exit status
The use of `ExitStatus` as the Rust type name for a Unix *wait
status*, not an *exit status*, is very confusing, but sadly probably
too late to change.

This area is confusing enough in Unix already (and many programmers
are already confuxed).  We can at least document it.

I chose *not* to mention the way shells like to exit with signal
numbers, thus turning signal numbers into exit statuses.  This is only
relevant for Rust programs using `std::process` if they run shells.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-02-23 00:58:10 +00:00
Ian Jackson d8cfd56985 process::unix: Test wait status formatting
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-02-23 00:58:10 +00:00
Dan Gohman e8dcc02dc5 Add a `size()` function to WASI's `MetadataExt`.
WASI's `filestat` type includes a size field, so expose it in
`MetadataExt` via a `size()` function, similar to the corresponding Unix
function.
2021-02-22 14:42:59 -08:00
The8472 81602fb670 fix io::copy specialization when writer was opened with O_APPEND 2021-02-22 21:41:32 +01:00
The8472 5c0d76dbe1 add test for failing io::copy specialization 2021-02-22 21:41:32 +01:00
Jonas Schievink 7bc501687b Avoid `cfg_if` in `std::os` 2021-02-22 19:56:20 +01:00
Ian Jackson fbd575aedf process::unix: Handle other wait statuses in ExitStatus as Display
Currently, on Nightly, this panics:

```
use std::process::ExitStatus;
use std::os::unix::process::ExitStatusExt;

fn main() {
    let st = ExitStatus::from_raw(0x007f);
    println!("st = {}", st);
}
```

This is because the impl of Display assumes that if .code() is None,
.signal() must be Some.  That was a false assumption, although it was
true with buggy code before
  5b1316f781
  unix ExitStatus: Do not treat WIFSTOPPED as WIFSIGNALED

This is not likely to have affected many people in practice, because
`Command` will never produce such a wait status (`ExitStatus`).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-02-22 18:15:42 +00:00
Richard Dodd 0d6640a5b0 Add impl `Error` for `Arc` 2021-02-22 12:49:42 +00:00
Ivan Tham bff4e937ab Add missing "see its documentation for more" stdio
StdoutLock and StderrLock does not have example, it would be better
to leave "see its documentation for more" like iter docs.
2021-02-22 18:48:32 +08:00
Yuki Okushi a5f6668920
Rollup merge of #82228 - ijackson:nonzero-cint, r=KodrAus
Provide NonZero_c_* integers

I'm pretty sure I am going want this for #73125 and it seems like an
omission that would be in any case good to remedy.

<strike>Because the raw C types are in `std`, not `core`, to achieve this we
must export the relevant macros from `core` so that `std` can use
them.  That's done with a new `num_internals` perma-unstable feature.

The macros need to take more parameters for the module to get the
types from and feature attributes to use.

I have eyeballed the docs output for core, to check that my changes to
these macros have made no difference to the core docs output.</strike>
2021-02-22 18:26:06 +09:00
Ashley Mannix 60a9dcc4e3
update tracking issue for raw_os_nonzero 2021-02-21 19:43:42 +10:00
Joshua Nelson 3733275854 Update the bootstrap compiler
Note this does not change `core::derive` since it was merged after the
beta bump.
2021-02-20 17:19:30 -05:00
Guillaume Gomez c26a8bbd6d
Rollup merge of #82244 - pickfire:patch-6, r=dtolnay
Keep consistency in example for Stdin StdinLock

Stdin uses handle whereas StdinLock uses stdin_lock, changed it to handle.
2021-02-20 20:37:01 +01:00
Dan Gohman 1abcdfe449 x.py fmt 2021-02-19 07:31:01 -08:00
Dylan DPC c821063a53
Rollup merge of #81873 - mark-i-m:unlock, r=m-ou-se
Add Mutex::unlock

Tracking issue: https://github.com/rust-lang/rust/issues/81872

Discussion: https://github.com/rust-lang/rust/pull/79434#issuecomment-757135874

r? `@m-ou-se`
2021-02-19 02:49:06 +01:00
mark e92e5fd787 add Mutex::unlock 2021-02-18 11:56:19 -06:00
LeSeulArtichaut ec20993c4d Stabilize `unsafe_op_in_unsafe_fn` lint 2021-02-18 17:12:15 +01:00
bors 25a2c13e9d Auto merge of #82249 - JohnTitor:rollup-3jbqija, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #82055 (Add diagnostics for specific cases for const/type mismatch err)
 - #82155 (Use !Sync std::lazy::OnceCell in usefulness checking)
 - #82202 (add specs for riscv32/riscv64 musl targets)
 - #82203 (Move some tests to more reasonable directories - 4)
 - #82211 (make `suggest_setup` help messages better)
 - #82212 (Remove redundant rustc_data_structures path component)
 - #82240 (remove useless ?s (clippy::needless_question_marks))
 - #82243 (Add more intra-doc links to std::io)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-18 07:22:30 +00:00
Yuki Okushi 21283dae9e
Rollup merge of #82243 - pickfire:patch-5, r=jyn514
Add more intra-doc links to std::io
2021-02-18 15:57:34 +09:00
bors d1462d8558 Auto merge of #81172 - SimonSapin:ptr-metadata, r=oli-obk
Implement RFC 2580: Pointer metadata & VTable

RFC: https://github.com/rust-lang/rfcs/pull/2580

~~Before merging this PR:~~

* [x] Wait for the end of the RFC’s [FCP to merge](https://github.com/rust-lang/rfcs/pull/2580#issuecomment-759145278).
* [x] Open a tracking issue: https://github.com/rust-lang/rust/issues/81513
* [x] Update `#[unstable]` attributes in the PR with the tracking issue number

----

This PR extends the language with a new lang item for the `Pointee` trait which is special-cased in trait resolution to implement it for all types. Even in generic contexts, parameters can be assumed to implement it without a corresponding bound.

For this I mostly imitated what the compiler was already doing for the `DiscriminantKind` trait. I’m very unfamiliar with compiler internals, so careful review is appreciated.

This PR also extends the standard library with new unstable APIs in `core::ptr` and `std::ptr`:

```rust
pub trait Pointee {
    /// One of `()`, `usize`, or `DynMetadata<dyn SomeTrait>`
    type Metadata: Copy + Send + Sync + Ord + Hash + Unpin;
}

pub trait Thin = Pointee<Metadata = ()>;

pub const fn metadata<T: ?Sized>(ptr: *const T) -> <T as Pointee>::Metadata {}

pub const fn from_raw_parts<T: ?Sized>(*const (), <T as Pointee>::Metadata) -> *const T {}
pub const fn from_raw_parts_mut<T: ?Sized>(*mut (),<T as Pointee>::Metadata) -> *mut T {}

impl<T: ?Sized> NonNull<T> {
    pub const fn from_raw_parts(NonNull<()>, <T as Pointee>::Metadata) -> NonNull<T> {}

    /// Convenience for `(ptr.cast(), metadata(ptr))`
    pub const fn to_raw_parts(self) -> (NonNull<()>, <T as Pointee>::Metadata) {}
}

impl<T: ?Sized> *const T {
    pub const fn to_raw_parts(self) -> (*const (), <T as Pointee>::Metadata) {}
}

impl<T: ?Sized> *mut T {
    pub const fn to_raw_parts(self) -> (*mut (), <T as Pointee>::Metadata) {}
}

/// `<dyn SomeTrait as Pointee>::Metadata == DynMetadata<dyn SomeTrait>`
pub struct DynMetadata<Dyn: ?Sized> {
    // Private pointer to vtable
}

impl<Dyn: ?Sized> DynMetadata<Dyn> {
    pub fn size_of(self) -> usize {}
    pub fn align_of(self) -> usize {}
    pub fn layout(self) -> crate::alloc::Layout {}
}

unsafe impl<Dyn: ?Sized> Send for DynMetadata<Dyn> {}
unsafe impl<Dyn: ?Sized> Sync for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> Debug for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> Unpin for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> Copy for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> Clone for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> Eq for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> PartialEq for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> Ord for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> PartialOrd for DynMetadata<Dyn> {}
impl<Dyn: ?Sized> Hash for DynMetadata<Dyn> {}
```

API differences from the RFC, in areas noted as unresolved questions in the RFC:

* Module-level functions instead of associated `from_raw_parts` functions on `*const T` and `*mut T`, following the precedent of `null`, `slice_from_raw_parts`, etc.
* Added `to_raw_parts`
2021-02-18 04:22:16 +00:00
Ivan Tham 026be9dc26
Keep consistency in example for Stdin StdinLock
Stdin uses handle whereas StdinLock uses stdin_lock, changed it to handle.
2021-02-18 10:11:57 +08:00
Ivan Tham 250eeb4c3c
Add missing link from stdio doc 2021-02-18 09:58:15 +08:00
Dylan DPC db59950b6d
Rollup merge of #77728 - lygstate:master, r=Amanieu
Expose force_quotes on Windows.

On Windows, the arg quotes and not quotes have different effect
for the program it called, if the program called are msys2/cygwin program.
Refer to
https://github.com/msys2/MSYS2-packages/issues/2176

This also solve the issues comes from

https://internals.rust-lang.org/t/std-process-on-windows-is-escaping-raw-literals-which-causes-problems-with-chaining-commands/8163

Tracking issue:
https://github.com/rust-lang/rust/issues/82227
2021-02-17 23:51:12 +01:00
Ian Jackson e78b5012f5 Provide NonZero_c_* integers
I'm pretty sure I am going want this for #73125 and it seems like an
omission that would be in any case good to remedy.

It's a shame we don't have competent token pasting and case mangling
for use in macro_rules!.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-02-17 20:48:22 +00:00
Ian Jackson d6b9d9a1d6 std::src::os::raw: Refactor, introducing macro type_alias!
This file contained a lot of repetitive code.  This was about to get
considerably worse, with introduction of a slew of new aliases.

No functional change.  I've eyeballed the docs and they don't seem to
have changed either.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2021-02-17 20:36:59 +00:00
Yonggang Luo fa23ddf6e6 Expose force_quotes on Windows.
Quotes the arg and not quotes the arg have different effect on Windows when the program called
are msys2/cygwin program.
Refer to https://github.com/msys2/MSYS2-packages/issues/2176

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
2021-02-17 17:54:04 +00:00
Ryan Lopopolo 2fcb8b5c20
Optimize FromIterator<OsString> to reuse the first allocation 2021-02-16 14:20:26 -08:00
Manish Goregaokar a98b22c837 Add caveat to Path::display() about lossiness 2021-02-16 11:45:46 -08:00
Andrea Nall 67fcaaaa7a a few more diagnostic items 2021-02-16 02:32:21 +00:00
Andrea Nall c6bb62810a requested/proposed changes 2021-02-15 22:59:47 +00:00
Jonas Schievink c87ef218f9
Rollup merge of #82120 - sfackler:arguments-as-str, r=dtolnay
Stabilize Arguments::as_str

Closes #74442
2021-02-15 16:07:08 +01:00
Jonas Schievink 2030a54f9d
Rollup merge of #82119 - m-ou-se:typo, r=dtolnay
Fix typo in link to CreateSymbolicLinkW documentation.
2021-02-15 16:07:06 +01:00
Jonas Schievink 7842b5d2ec
Rollup merge of #82063 - NULLx76:fix-minor-typo, r=jonas-schievink
Fixed minor typo in catch_unwind docs

Changed "a an exception" to "an exception" inside of the `std::panic::catch_unwind` docs.
2021-02-15 16:06:58 +01:00
Jonas Schievink bd0e8a5df3
Rollup merge of #81975 - Amanieu:seal2, r=m-ou-se
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-15 16:06:54 +01:00
Simon Sapin 21ceebf296 Fix intra-doc link to raw pointer method
CC https://github.com/rust-lang/rust/pull/80181
2021-02-15 14:27:50 +01:00
Andrea Nall 5ef202520f add diagnostic items
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-15 02:27:28 +00:00
Ryan Lopopolo 3ed6184434
Implement Extend and FromIterator for OsString
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-14 15:01:46 -08:00
Steven Fackler 4613b3764c Stabilize Arguments::as_str
Closes #74442
2021-02-14 17:48:51 -05:00
Mara Bos 1aa965101c Fix typo in link to CreateSymbolicLinkW documentation. 2021-02-14 23:16:45 +01:00
Victor Roest ee9709fae6
Fixed minor typo in catch_unwind docs
Changed 'a an exception' to 'an exception'
2021-02-13 16:59:06 +01:00
Dylan DPC 354f19cf24
Rollup merge of #81850 - the8472:env-rwlock, r=m-ou-se
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-12 22:53:33 +01:00
Dan Gohman 0060c91cfc Make WASI's `hard_link` behavior match other platforms.
Following #78026, `std::fs::hard_link` on most platforms does not follow
symlinks. Change the WASI implementation to also not follow symlinks.
2021-02-10 17:52:36 -08:00
Amanieu d'Antras bfd1ccfb27 Seal the CommandExt, OsStrExt and OsStringExt traits 2021-02-10 21:30:30 +00:00
Jacob Pratt c28f2a8bee
Stabilize str_split_once 2021-02-09 23:17:11 -05:00
Yuki Okushi bb06b13131
Rollup merge of #79849 - Digital-Chaos:sleep-zero, r=m-ou-se
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-10 12:24:18 +09:00
The8472 4fc181dd62 split guard into read and write types 2021-02-09 19:13:21 +01:00
The8472 44abad5b12 introduce StaticRWLock wrapper to make methods safe 2021-02-08 23:35:02 +01:00
The8472 2200cf10d8 avoid &mut on the read path since it now allows concurrent readers 2021-02-08 23:31:49 +01:00
Mara Bos 15de287cd5 Remove outdated comment. 2021-02-08 22:27:34 +01:00
Vadim Petrochenkov dbdbd30bf2 expand/resolve: Turn `#[derive]` into a regular macro attribute 2021-02-07 20:08:45 +03:00
The8472 406fd3a277 silence dead code warnings on windows 2021-02-07 09:45:49 +01:00
The8472 55ca27faa7 use rwlock for accessing ENV 2021-02-07 09:12:21 +01:00
bors 0961ae83b8 Auto merge of #81821 - nikic:update-wasm32, r=sanxiyn
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-07 02:36:08 +00:00
Martin Habovstiak 66f7f7d8a9 Added `try_exists()` method to `std::path::Path`
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-06 22:16:54 +01:00
Nikita Popov 55e237284f 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-06 13:05:56 +01:00
Mara Bos ce1020fc55
Rollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton
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-05 12:26:00 +01:00
Mara Bos 6f014cd4db
Rollup merge of #81745 - Kixunil:stabilize_once_poison, r=m-ou-se
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-04 21:10:44 +01:00
Mara Bos e0ddc053f9
Rollup merge of #81711 - saethlin:ipaddr-inline, r=m-ou-se
add #[inline] to all the public IpAddr functions
2021-02-04 21:10:39 +01:00
Mara Bos 21e5827800
Rollup merge of #81710 - TyPR124:patch-2, r=m-ou-se
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-04 21:10:37 +01:00
Martin Habovstiak f42e96149d 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
2021-02-04 15:20:14 +01:00
Yoshua Wuyts 2c8bf1db54 Stabilize the Wake trait
Co-Authored-By: Ashley Mannix <kodraus@hey.com>
2021-02-03 16:54:29 +01:00
Ben Kimock d3d0fb7b45 add #[inline] to all the public IpAddr functions 2021-02-03 10:53:25 -05:00
Ingvar Stepanyan f4b1bef542
Restore comment as it was 2021-02-03 15:46:57 +00:00
Ingvar Stepanyan 1578f2e1e8
Keep old symlink; expose new symlink_path 2021-02-03 15:45:30 +00:00
Tyler Ruckinger 4d1efb751a
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-03 10:28:51 -05:00
Jack Huey d3304c8ac3
Rollup merge of #81588 - xfix:delete-doc-alias, r=Mark-Simulacrum
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-02 16:01:41 -05:00
Jack Huey 76be6bb4de
Rollup merge of #81530 - ojeda:sys-use-abort-instead-of-wasm32-unreachable, 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-02 16:01:38 -05:00
Jack Huey 399c0a8e52
Rollup merge of #81455 - Amanieu:aarch64_ilp32, r=sanxiyn
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-02 16:01:35 -05:00
Jonas Schievink f61ab58574
Rollup merge of #81022 - seanchen1991:feat/frames-iter, r=KodrAus
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-02 12:14:49 +01:00
Amanieu d'Antras 3408c58bdf Fix AArch64 types in std::os::raw 2021-02-02 05:49:31 +00:00
Jonas Schievink 2622227208
Rollup merge of #81598 - sivadeilra:windows_dll_imports_fix_x86, r=m-ou-se
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-01 14:29:45 +01:00
Jonas Schievink a7a6f013a2
Rollup merge of #78641 - the8472:buffered-copy, r=sfackler
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-01 14:29:28 +01:00
bors e0d9f79399 Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov
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: c5273bdfb2 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.
2021-02-01 10:25:31 +00:00
Arlie Davis 3acd1a4f92 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.
2021-01-31 08:49:23 -08:00
Jonas Schievink 47a5312c30
Rollup merge of #81549 - est31:wording_fix, r=jonas-schievink
Misc ip documentation fixes
2021-01-31 16:36:47 +01:00
The8472 4105506656 specialize io::copy to use the memory of the writer if it is a BufWriter 2021-01-31 14:58:03 +01:00
Xavientois 7674ae1a4e Fix line length format 2021-01-31 08:52:57 -05:00
Xavientois fc9cd4a14b Fix formatting on mod 2021-01-31 08:34:42 -05:00
Xavientois 81aba388f1 Add space for proper indentation 2021-01-31 08:34:42 -05:00
Xavientois b837f3a99b Remove trailing newline 2021-01-31 08:34:42 -05:00
Xavientois 389e638c05 Add tests for SizeHint implementations 2021-01-31 08:34:42 -05:00
Xavientois 96255f82c9 Implement SizeHint trait for BufReader, Emtpy, and Chain 2021-01-31 08:34:42 -05:00
Xavientois c8e0f8aaa3 Use fully qualified syntax to avoid dyn 2021-01-31 08:31:35 -05:00
Xavientois 7869371bf1 Remove unnecessary default keyword 2021-01-31 08:31:35 -05:00
Xavientois 93870c8d5f Remove stable annotation 2021-01-31 08:31:35 -05:00
Xavientois 265db94dc2 Fix formatting 2021-01-31 08:31:35 -05:00
Xavientois 421b40cd6a Add dyn for SizeHint cast 2021-01-31 08:31:35 -05:00
Xavientois 1190321b76 Remove exposing private trait 2021-01-31 08:31:35 -05:00
Xavientois 442de9ac45 Fix semicolon 2021-01-31 08:31:35 -05:00
Xavientois 7e56637c74 Add back lower_bound as memeber 2021-01-31 08:31:35 -05:00
Xavientois eea99f491b Add default keyword for specialization 2021-01-31 08:31:34 -05:00
Xavientois 5f60a3048e Fix incorrect token 2021-01-31 08:31:34 -05:00
Xavientois 260a270f7c Move default to trait definition 2021-01-31 08:31:34 -05:00
Xavientois 11c49f6a2a Add missing generic 2021-01-31 08:31:34 -05:00
Xavientois fa76db3104 Use helper trait to follow min_specialization rules 2021-01-31 08:31:34 -05:00
Xavientois c3e47d974a Fix implementation to specialize 2021-01-31 08:31:34 -05:00
Xavientois f45bdcce69 Implement size_hint for BufReader 2021-01-31 08:31:34 -05:00
Konrad Borowski 15701f7531 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-01-31 11:07:37 +01:00
bors 0e63af5da3 Auto merge of #81478 - sivadeilra:windows_dll_imports, r=m-ou-se
Resolve DLL imports at CRT startup, not on demand

On Windows, libstd uses GetProcAddress to locate some DLL imports, so
that libstd can run on older versions of Windows. If a given DLL import
is not present, then libstd uses other behavior (such as fallback
implementations).

This commit uses a feature of the Windows CRT to do these DLL imports
during module initialization, before main() (or DllMain()) is called.
This is the ideal time to resolve imports, because the module is
effectively single-threaded at that point; no other threads can
touch the data or code of the module that is being initialized.

This avoids several problems. First, it makes the cost of performing
the DLL import lookups deterministic. Right now, the DLL imports are
done on demand, which means that application threads _might_ have to
do the DLL import during some time-sensitive operation. This is a
small source of unpredictability. Since threads can race, it's even
possible to have more than one thread running the same redundant
DLL lookup.

This commit also removes using the heap to allocate strings, during
the DLL lookups.
2021-01-31 10:01:15 +00:00
Jonas Schievink 635dbd60bf
Rollup merge of #81550 - xfix:replace-mention-of-predecessor, r=jonas-schievink
Replace predecessor with range in collections documentation

Fixes #81548.
2021-01-31 01:47:43 +01:00
Jonas Schievink 1bf130519c
Rollup merge of #78044 - oberien:empty-seek, r=m-ou-se
Implement io::Seek for io::Empty

Fix #78029
2021-01-31 01:47:18 +01:00
oberien f1cd17961c impl Seek for Empty
Fix #78029
2021-01-30 23:00:10 +01:00
Konrad Borowski 56c27360b1 Replace predecessor with range in collections documentation
Fixes #81548.
2021-01-30 14:24:06 +01:00
est31 cddeb5e47b Misc ip documentation fixes 2021-01-30 12:06:06 +01:00
Yuki Okushi b94d84d38a
Rollup merge of #80886 - RalfJung:stable-raw-ref-macros, r=m-ou-se
Stabilize raw ref macros

This stabilizes `raw_ref_macros` (https://github.com/rust-lang/rust/issues/73394), which is possible now that https://github.com/rust-lang/rust/issues/74355 is fixed.

However, as I already said in https://github.com/rust-lang/rust/issues/73394#issuecomment-751342185, I am not particularly happy with the current names of the macros. So I propose we also change them, which means I am proposing to stabilize the following in `core::ptr`:
```rust
pub macro const_addr_of($e:expr) {
    &raw const $e
}

pub macro mut_addr_of($e:expr) {
    &raw mut $e
}
```

The macro name change means we need another round of FCP. Cc `````@rust-lang/libs`````
Fixes #73394
2021-01-30 13:36:43 +09:00
Yuki Okushi ecd7cb1c3a
Rollup merge of #79023 - yoshuawuyts:stream, r=KodrAus
Add `core::stream::Stream`

[[Tracking issue: #79024](https://github.com/rust-lang/rust/issues/79024)]

This patch adds the `core::stream` submodule and implements `core::stream::Stream` in accordance with [RFC2996](https://github.com/rust-lang/rfcs/pull/2996). The RFC hasn't been merged yet, but as requested by the libs team in https://github.com/rust-lang/rfcs/pull/2996#issuecomment-725696389 I'm filing this PR to get the ball rolling.

## Documentatation

The docs in this PR have been adapted from [`std::iter`](https://doc.rust-lang.org/std/iter/index.html), [`async_std::stream`](https://docs.rs/async-std/1.7.0/async_std/stream/index.html), and [`futures::stream::Stream`](https://docs.rs/futures/0.3.8/futures/stream/trait.Stream.html). Once this PR lands my plan is to follow this up with PRs to add helper methods such as `stream::repeat` which can be used to document more of the concepts that are currently missing. That will allow us to cover concepts such as "infinite streams" and "laziness" in more depth.

## Feature gate

The feature gate for `Stream` is `stream_trait`. This matches the `#[lang = "future_trait"]` attribute name. The intention is that only the APIs defined in RFC2996 will use this feature gate, with future additions such as `stream::repeat` using their own feature gates. This is so we can ensure a smooth path towards stabilizing the `Stream` trait without needing to stabilize all the APIs in `core::stream` at once. But also don't start expanding the API until _after_ stabilization, as was the case with `std::future`.

__edit:__ the feature gate has been changed to `async_stream` to match the feature gate proposed in the RFC.

## Conclusion

This PR introduces `core::stream::{Stream, Next}` and re-exports it from `std` as `std::stream::{Stream, Next}`. Landing `Stream` in the stdlib has been a mult-year process; and it's incredibly exciting for this to finally happen!

---

r? `````@KodrAus`````
cc/ `````@rust-lang/wg-async-foundations````` `````@rust-lang/libs`````
2021-01-30 13:36:39 +09:00
Ingvar Stepanyan 5882cce54e 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, 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.
2021-01-30 02:30:52 +00:00
Miguel Ojeda c7f4154c6a 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.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-01-29 20:25:23 +01:00
Arlie Davis f4debc8e94 Resolve DLL imports at CRT startup, not on demand
On Windows, libstd uses GetProcAddress to locate some DLL imports, so
that libstd can run on older versions of Windows. If a given DLL import
is not present, then libstd uses other behavior (such as fallback
implementations).

This commit uses a feature of the Windows CRT to do these DLL imports
during module initialization, before main() (or DllMain()) is called.
This is the ideal time to resolve imports, because the module is
effectively single-threaded at that point; no other threads can
touch the data or code of the module that is being initialized.

This avoids several problems. First, it makes the cost of performing
the DLL import lookups deterministic. Right now, the DLL imports are
done on demand, which means that application threads _might_ have to
do the DLL import during some time-sensitive operation. This is a
small source of unpredictability. Since threads can race, it's even
possible to have more than one thread running the same redundant
DLL lookup.

This commit also removes using the heap to allocate strings, during
the DLL lookups.
2021-01-29 10:41:49 -08:00
Ralf Jung 13ffa43bbb rename raw_const/mut -> const/mut_addr_of, and stabilize them 2021-01-29 15:18:45 +01:00
Yuki Okushi 025a850d21
Rollup merge of #70904 - LukasKalbertodt:stabilize-seek-convenience, r=m-ou-se
Stabilize `Seek::stream_position` (feature `seek_convenience`)

Tracking issue: #59359

Unresolved questions from tracking issue:
- "Override `stream_len` for `File`?" → we can do that in the future, this does not block stabilization.
- "Rename to `len` and `position`?" → as noted in the tracking issue, both of these shorter names have problems (`len` is usually a cheap getter, `position` clashes with `Cursor`). I do think the current names are perfectly fine.
- "Rename `stream_position` to `tell`?" → as mentioned in [the comment bringing this up](https://github.com/rust-lang/rust/issues/59359#issuecomment-559541545), `stream_position` is more descriptive. I don't think `tell` would be a good name.

What remains to decide, is whether or not adding these methods is worth it.
2021-01-28 15:09:00 +09:00
bors a2f8f62818 Auto merge of #81335 - thomwiggers:no-panic-shrink-to, r=Mark-Simulacrum
Trying to shrink_to greater than capacity should be no-op

Per the discussion in https://github.com/rust-lang/rust/issues/56431, `shrink_to` shouldn't panic if you try to make a vector shrink to a capacity greater than its current capacity.
2021-01-27 18:36:32 +00:00
Thom Wiggers d069c58e78
shrink_to shouldn't panic on len greater than capacity 2021-01-26 19:25:37 +01:00
Mara Bos fc7c5e486c Make std::panic_2021 an alias for core::panic_2021. 2021-01-25 13:49:00 +01:00
Mara Bos d5414f9a9f Implement new panic!() behaviour for Rust 2021. 2021-01-25 13:48:11 +01:00
Jonas Schievink 13b88c21d0
Rollup merge of #79174 - taiki-e:std-future, r=Mark-Simulacrum
Make std::future a re-export of core::future

After 1a764a7ef5, there are no `std::future`-specific items (except for `cfg(bootstrap)` items removed in 93eed402ad). So, instead of defining `std` own module, we can re-export the `core::future` directly.
2021-01-24 22:09:49 +01:00
Jonas Schievink 5a1f2ecdd7
Rollup merge of #75180 - KodrAus:feat/error-by-ref, r=m-ou-se
Implement Error for &(impl Error)

Opening this up just to see what it breaks. It's unfortunate that `&(impl Error)` doesn't actually implement `Error`. If this direct approach doesn't work out then I'll try something different, like an `Error::by_ref` method.

**EDIT:** This is a super low-priority experiment so feel free to cancel it for more important crater runs! 🙂

-----

# Stabilization Report

## Why?

We've been working for the last few years to try "fix" the `Error` trait, which is probably one of the most fundamental in the whole standard library. One of its issues is that we commonly expect you to work with abstract errors through `dyn Trait`, but references and smart pointers over `dyn Trait` don't actually implement the `Error` trait. If you have a `&dyn Error` or a `Box<dyn Error>` you simply can't pass it to a method that wants a `impl Error`.

## What does this do?

This stabilizes the following trait impl:

```rust
impl<'a, T: Error + ?Sized + 'static> Error for &'a T;
```

This means that `&dyn Error` will now satisfy a `impl Error` bound.

It doesn't do anything with `Box<dyn Error>` directly. We discussed how we could do `Box<dyn Error>` in the thread here (and elsewhere in the past), but it seems like we need something like lattice-based specialization or a sprinkling of snowflake compiler magic to make that work. Having said that, with this new impl you _can_ now get a `impl Error` from a `Box<dyn Error>`  by dereferencing it.

## What breaks?

A crater run revealed a few crates broke with something like the following:

```rust
// where e: &'short &'long dyn Error
err.source()
```

previously we'd auto-deref that `&'short &'long dyn Error` to return a `Option<&'long dyn Error>` from `source`, but now will call directly on `&'short impl Error`, so will return a `Option<&'short dyn Error>`. The fix is to manually deref:

```rust
// where e: &'short &'long dyn Error
(*err).source()
```

In the recent Libs meeting we considered this acceptable breakage.
2021-01-24 22:09:45 +01:00
bors 9a9477fada Auto merge of #81250 - sivadeilra:remove_xp_compat, r=joshtriplett,m-ou-se
Remove delay-binding for Win XP and Vista

The minimum supported Windows version is now Windows 7. Windows XP
and Windows Vista are no longer supported; both are already broken, and
require extra steps to use.

This commit removes the delayed-binding support for Windows API
functions that are present on all supported Windows targets. This has
several benefits: Removes needless complexity. Removes a load and
dynamic call on hot paths in mutex acquire / release. This may have
performance benefits.

* "Drop official support for Windows XP"
  https://github.com/rust-lang/compiler-team/issues/378

* "Firefox has ended support for Windows XP and Vista"
  https://support.mozilla.org/en-US/kb/end-support-windows-xp-and-vista
2021-01-24 12:34:08 +00:00
Lukas Kalbertodt 8a18fb0f73
Stabilize `Seek::stream_position` & change feature of `Seek::stream_len` 2021-01-24 10:14:24 +01:00
Jonas Schievink 44c668cfca
Rollup merge of #81281 - a1phyr:inline_path, r=dtolnay
Inline methods of Path and OsString

These methods are not generic, and therefore aren't candidates for cross-crate inlining without an `#[inline]` attribute.
2021-01-23 20:16:12 +01:00
Sean Chen 050643a960 Add Frames iterator for Backtrace 2021-01-23 11:56:33 -06:00
bors 22ddcd1a13 Auto merge of #72160 - slo1:libstd-setgroups, r=KodrAus
Add setgroups to std::os::unix::process::CommandExt

Should fix #38527. I'm not sure groups is the greatest name though.
2021-01-22 19:00:11 +00:00
Benoît du Garreau 9880560a1c Inline methods of Path and OsString 2021-01-22 18:46:00 +01:00
Yoshua Wuyts 0c8db16a67 Add `core::stream::Stream`
This patch adds the `core::stream` submodule and implements `core::stream::Stream` in accordance with RFC2996.

Add feedback from @camelid
2021-01-22 17:41:56 +01:00
Mara Bos 81a60b7aa8
Rollup merge of #81233 - lzutao:dbg, r=KodrAus
Document why not use concat! in dbg! macro

Original title: Reduce code generated by `dbg!` macro
The expanded code before/after: <https://rust.godbolt.org/z/hE3j95>.

---

We cannot use `concat!` since `file!` could contains `{` or the expression is a block (`{ .. }`).
Using it will generated malformed format strings.
So let's document this reason why we don't use `concat!` macro at all.
2021-01-22 14:30:17 +00:00
Mara Bos 950ed27e8b
Rollup merge of #81202 - lzutao:dbg_ipv6, r=Amanieu
Don't prefix 0x for each segments in `dbg!(Ipv6)`

Fixes #81182
2021-01-22 14:30:12 +00:00
Mara Bos b59f6e05ef
Rollup merge of #81194 - m-ou-se:stabilize-panic-any, r=m-ou-se
Stabilize std::panic::panic_any.

This stabilizes `std::panic::panic_any`.
2021-01-22 14:30:11 +00:00
Arlie Davis 59855e0bbf Remove delay-binding for Win XP and Vista
The minimum supported Windows version is now Windows 7. Windows XP
and Windows Vista are no longer supported; both are already broken, and
require extra steps to use.

This commit removes the delayed-binding support for Windows API
functions that are present on all supported Windows targets. This has
several benefits: Removes needless complexity. Removes a load and
dynamic call on hot paths in mutex acquire / release. This may have
performance benefits.

* "Drop official support for Windows XP"
  https://github.com/rust-lang/compiler-team/issues/378

* "Firefox has ended support for Windows XP and Vista"
  https://support.mozilla.org/en-US/kb/end-support-windows-xp-and-vista
2021-01-22 02:02:39 -08:00
slo1 41e6b23000 Add setgroups to std::os::unix::process::CommandExt 2021-01-21 22:42:38 -08:00
bors a243ad280a Auto merge of #81240 - JohnTitor:rollup-ieaz82a, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #79655 (Add Vec visualization to understand capacity)
 - #80172 (Use consistent punctuation for 'Prelude contents' docs)
 - #80429 (Add regression test for mutual recursion in obligation forest)
 - #80601 (Improve grammar in documentation of format strings)
 - #81046 (Improve unknown external crate error)
 - #81178 (Visit only terminators when removing landing pads)
 - #81179 (Fix broken links with `--document-private-items` in the standard library)
 - #81184 (Remove unnecessary `after_run` function)
 - #81185 (Fix ICE in mir when evaluating SizeOf on unsized type)
 - #81187 (Fix typo in counters.rs)
 - #81219 (Document security implications of std::env::temp_dir)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-21 12:18:32 +00:00
Yuki Okushi d6c7a797fc
Rollup merge of #81219 - joshtriplett:temp_dir-docs, r=sfackler
Document security implications of std::env::temp_dir

Update the sample code to not create an insecure temporary file.
2021-01-21 20:04:56 +09:00
Yuki Okushi 9abd746a32
Rollup merge of #80172 - camelid:prelude-docs-consistent-punct, r=steveklabnik
Use consistent punctuation for 'Prelude contents' docs
2021-01-21 20:04:39 +09:00
Lzu Tao d0c1405564 Document why cannot use concat! in dbg!
Co-authored-by: Miguel Ojeda <ojeda@users.noreply.github.com>
2021-01-21 10:50:21 +00:00
bstrie 6f3df00610 Deprecate-in-future the constants superceded by RFC 2700 2021-01-20 20:08:11 -05:00
Josh Triplett 27f3764519 Document security implications of std::env::temp_dir
Update the sample code to not create an insecure temporary file.
2021-01-20 11:24:47 -08:00