Jane Lusby
e3839ccc83
fix broken doc comment
2022-06-13 14:47:51 -07:00
Jane Lusby
fb2d2e53fd
remove outdated references
2022-06-13 14:15:05 -07:00
Jane Lusby
03999c2394
Add provider API to error trait
2022-06-13 14:10:25 -07:00
Eduard-Mihai Burtescu
a4f1331b9d
[perf] std: add missing #[inline]
to DefaultHasher::{new,default}
.
2022-06-13 18:33:02 +00:00
bors
083721a1a7
Auto merge of #98038 - TaKO8Ki:remove-unnecessary-space-in-doc, r=compiler-errors
...
Remove an unnecessary space in doc
2022-06-13 04:26:05 +00:00
Takayuki Maeda
ba41d4c855
remove an unnecessary space in doc
2022-06-13 09:51:13 +09:00
Dylan DPC
a24ca03660
Rollup merge of #97992 - m-ou-se:stabilize-scoped-threads, r=joshtriplett
...
Stabilize scoped threads.
Tracking issue: https://github.com/rust-lang/rust/issues/93203
FCP finished here: https://github.com/rust-lang/rust/issues/93203#issuecomment-1152249466
2022-06-12 12:14:29 +02:00
Dylan DPC
cf3c41aa9d
Rollup merge of #97970 - dtolnay:terminate, r=joshtriplett
...
Fix Termination impl panic on closed stderr
Repro:
```rust
#![feature(backtrace)]
use std::backtrace::Backtrace;
use std::io::{self, Write as _};
use std::panic::{self, PanicInfo};
#[derive(Debug)]
pub struct Error;
fn panic_hook(panic_info: &PanicInfo) {
let backtrace = Backtrace::force_capture();
let _ = write!(io::stdout(), "{}\n{}", panic_info, backtrace);
}
fn main() -> Result<(), Error> {
panic::set_hook(Box::new(panic_hook));
let stderr = io::stderr();
let mut stderr = stderr.lock();
while stderr.write_all(b".\n").is_ok() {}
Err(Error)
}
```
### Before:
```console
$ target/debug/repro 3>&2 2>&1 1>&3 | head
.
.
.
.
.
.
.
.
.
.
panicked at 'failed printing to stderr: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
0: testing::panic_hook
at ./src/main.rs:11:21
1: core::ops::function::Fn::call
at /git/rust/library/core/src/ops/function.rs:77:5
2: std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic_handler::{{closure}}
4: std::sys_common::backtrace::__rust_end_short_backtrace
5: rust_begin_unwind
6: core::panicking::panic_fmt
7: std::io::stdio::_eprint
8: <core::result::Result<!,E> as std::process::Termination>::report
at /git/rust/library/std/src/process.rs:2164:9
9: <core::result::Result<(),E> as std::process::Termination>::report
at /git/rust/library/std/src/process.rs:2148:25
10: std::rt::lang_start::{{closure}}
at /git/rust/library/std/src/rt.rs:145:18
11: std::rt::lang_start_internal
12: std::rt::lang_start
at /git/rust/library/std/src/rt.rs:144:17
13: main
14: __libc_start_main
at /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
15: _start
```
### After:
```console
$ target/debug/repro 3>&2 2>&1 1>&3 | head
.
.
.
.
.
.
.
.
.
.
```
2022-06-12 12:14:27 +02:00
Michael Howell
80b201da7d
Update library/std/src/primitive_docs.rs
...
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2022-06-11 20:07:10 -07:00
DrMeepster
940e0b3765
fix compat_fn option method on miri
2022-06-11 16:52:59 -07:00
Michael Howell
c1487550ca
Add test case for #trait-implementations-1 link
2022-06-11 09:54:23 -07:00
Michael Howell
3fd16648fe
Re-add explicit list of traits to tuple docs, with limit notes
2022-06-11 09:54:23 -07:00
Michael Howell
090c68ba5c
Use relative path for addressing things in rust-lang/rust
...
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2022-06-11 09:54:23 -07:00
Michael Howell
9b31323b8f
Fix incorrectly spelled "variadic"
2022-06-11 09:54:20 -07:00
Mara Bos
ae0a533b0b
Stabilize scoped threads.
2022-06-11 15:01:52 +02:00
David Tolnay
563aa12a22
Do not panic in Termination impl on closed stderr
...
Repro:
#![feature(backtrace)]
use std::backtrace::Backtrace;
use std::io::{self, Write as _};
use std::panic::{self, PanicInfo};
#[derive(Debug)]
pub struct Error;
fn panic_hook(panic_info: &PanicInfo) {
let backtrace = Backtrace::force_capture();
let _ = write!(io::stdout(), "{}\n{}", panic_info, backtrace);
}
fn main() -> Result<(), Error> {
panic::set_hook(Box::new(panic_hook));
let stderr = io::stderr();
let mut stderr = stderr.lock();
while stderr.write_all(b".\n").is_ok() {}
Err(Error)
}
Before:
$ RUST_BACKTRACE=1 target/debug/testing 3>&2 2>&1 1>&3 | head
.
.
.
.
.
.
.
.
.
.
panicked at 'failed printing to stderr: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
0: testing::panic_hook
at ./src/main.rs:11:21
1: core::ops::function::Fn::call
at /git/rust/library/core/src/ops/function.rs:77:5
2: std::panicking::rust_panic_with_hook
3: std::panicking::begin_panic_handler::{{closure}}
4: std::sys_common::backtrace::__rust_end_short_backtrace
5: rust_begin_unwind
6: core::panicking::panic_fmt
7: std::io::stdio::_eprint
8: <core::result::Result<!,E> as std::process::Termination>::report
at /git/rust/library/std/src/process.rs:2164:9
9: <core::result::Result<(),E> as std::process::Termination>::report
at /git/rust/library/std/src/process.rs:2148:25
10: std::rt::lang_start::{{closure}}
at /git/rust/library/std/src/rt.rs:145:18
11: std::rt::lang_start_internal
12: std::rt::lang_start
at /git/rust/library/std/src/rt.rs:144:17
13: main
14: __libc_start_main
at /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
15: _start
After:
$ RUST_BACKTRACE=1 target/debug/testing 3>&2 2>&1 1>&3 | head
.
.
.
.
.
.
.
.
.
.
2022-06-10 13:42:28 -07:00
Martin Kröning
8537a1fd50
docs: Consistently mark ExitStatus as code
2022-06-10 20:26:41 +02:00
Martin Kröning
3b45521acf
docs: Link to ExitCode instead of ExitStatus in ExitStatus
2022-06-10 20:25:36 +02:00
Martin Kröning
30c882521c
docs: Fix typo in ExitStatus
2022-06-10 20:24:45 +02:00
Aron Parker
b13af732f7
Make "windows_process_exit_code_from" unstable
2022-06-10 14:55:13 +02:00
Aron Parker
eb783d9632
Incorporate warning for potential exit code ambiguities
2022-06-10 14:33:19 +02:00
Aron Parker
5d32f313fb
Fix copy paste error
2022-06-10 14:21:49 +02:00
bors
ec55c61305
Auto merge of #96837 - tmiasko:stdio-fcntl, r=joshtriplett
...
Use `fcntl(fd, F_GETFD)` to detect if standard streams are open
In the previous implementation, if the standard streams were open,
but the RLIMIT_NOFILE value was below three, the poll would fail
with EINVAL:
> ERRORS: EINVAL The nfds value exceeds the RLIMIT_NOFILE value.
Switch to the existing fcntl based implementation to avoid the issue.
Fixes #96621 .
2022-06-10 11:50:39 +00:00
Yuki Okushi
3e5ddb73a8
Rollup merge of #97922 - paolobarbolini:no-vecdeque-extra-reserve, r=the8472
...
Remove redundant calls to reserve in impl Write for VecDeque
Removes the reserve calls made redundant by #95904 (as discussed in https://github.com/rust-lang/rust/pull/95632#discussion_r846850293 )
2022-06-10 17:22:31 +09:00
bors
52ee2a2738
Auto merge of #95770 - nrc:read-buf-builder, r=joshtriplett
...
std::io: Modify some ReadBuf method signatures to return `&mut Self`
This allows using `ReadBuf` in a builder-like style and to setup a `ReadBuf` and
pass it to `read_buf` in a single expression, e.g.,
```
// With this PR:
reader.read_buf(ReadBuf::uninit(buf).assume_init(init_len))?;
// Previously:
let mut buf = ReadBuf::uninit(buf);
buf.assume_init(init_len);
reader.read_buf(&mut buf)?;
```
r? `@sfackler`
cc https://github.com/rust-lang/rust/issues/78485 , https://github.com/rust-lang/rust/issues/94741
2022-06-10 03:55:16 +00:00
The 8472
2e62fdab76
use fcntl fallback for additional poll-specific errors
2022-06-10 01:36:50 +02:00
Josh Stone
34895ded2c
Avoid thread::panicking()
in non-poisoning methods of Mutex
and RwLock
...
`Mutex::lock()` and `RwLock::write()` are poison-guarded against panics,
in that they set the poison flag if a panic occurs while they're locked.
But if we're already in a panic (`thread::panicking()`), they leave the
poison flag alone.
That check is a bit of a waste for methods that never set the poison
flag though, namely `get_mut()`, `into_inner()`, and `RwLock::read()`.
These use-cases are now split to avoid that unnecessary call.
2022-06-09 11:51:39 -07:00
Paolo Barbolini
c71e73eb61
Remove redundant calls to reserve in impl Write for VecDeque
2022-06-09 19:10:09 +02:00
Aron Parker
0503bc0149
Implement ExitCodeExt for Windows
2022-06-09 15:32:01 +02:00
Tobias Bucher
89f41839e4
Implement fmt::Write
for OsString
...
This allows to format into an `OsString` without unnecessary
allocations. E.g.
```
let mut temp_filename = path.into_os_string();
write!(&mut temp_filename, ".tmp.{}", process::id());
```
2022-06-09 14:27:01 +02:00
Yuki Okushi
f14ccdbf6a
Rollup merge of #95632 - evanrichter:master, r=joshtriplett
...
impl Read and Write for VecDeque<u8>
Implementing `Read` and `Write` for `VecDeque<u8>` fills in the VecDeque api surface where `Vec<u8>` and `Cursor<Vec<u8>>` already impl Read and Write. Not only for completeness, but VecDeque in particular is a very handy mock interface for a TCP echo service, if only it supported Read/Write.
Since this PR is just an impl trait, I don't think there is a way to limit it behind a feature flag, so it's "insta-stable". Please correct me if I'm wrong here, not trying to rush stability.
2022-06-09 19:19:54 +09:00
Michael Howell
9f6dcceef0
Fix bootstrap attr
2022-06-08 20:06:54 -07:00
Michael Howell
85b0c2ffbb
rustdoc: fixed messed-up rustdoc auto trait impls
...
Before:
impl<T, U> UnwindSafe for (T, ...) where
T: UnwindSafe,
U: UnwindSafe,
After:
impl<T> UnwindSafe for (T, ...) where
T: UnwindSafe,
2022-06-08 19:51:54 -07:00
Michael Howell
6950f144cf
rustdoc: show tuple impls as impl Trait for (T, ...)
...
This commit adds a new unstable attribute, `#[doc(tuple_varadic)]`, that
shows a 1-tuple as `(T, ...)` instead of just `(T,)`, and links to a section
in the tuple primitive docs that talks about these.
2022-06-08 19:26:51 -07:00
Gary Guo
6ef2033884
Fix FFI-unwind unsoundness with mixed panic mode
2022-06-08 21:32:41 +01:00
Michael Goulet
888d72c2bf
Rollup merge of #97830 - LucasDumont:add-example-alloc, r=yaahc
...
Add std::alloc::set_alloc_error_hook example
2022-06-08 13:32:19 -07:00
Dan Gohman
69594414bf
Fix trailing whitespace.
2022-06-08 08:40:34 -07:00
Dan Gohman
158ff5cdd4
Reword the question in the section header too.
...
This adopts the wording suggested in
https://github.com/rust-lang/rust/pull/97837#discussion_r892524129 .
2022-06-08 08:28:36 -07:00
Dan Gohman
e89ec68d5d
Update library/std/src/os/unix/io/mod.rs
...
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2022-06-08 08:26:56 -07:00
Dan Gohman
7656e085e3
Reword a question into a statement.
2022-06-08 08:24:28 -07:00
Stefan Lankes
85b5f74043
remove unneeded code
2022-06-08 15:35:49 +02:00
Chris Denton
34fafd363c
Windows: No panic if function not (yet) available
...
In some situations it is possible for required functions to be called before they've had a chance to be loaded. Therefore, we make it possible to recover from this situation simply by looking at error codes.
2022-06-07 21:22:53 +01:00
Gus Wynn
63d1c86230
[core] add Exclusive to sync
2022-06-07 13:10:50 -07:00
Michael Howell
7a93567005
docs: show Clone and Copy on () doc pages
2022-06-07 12:12:49 -07:00
Nikolai Vazquez
246a80c32c
Inline Windows OsStrExt::encode_wide
...
User crates currently produce much more code than necessary because the
optimizer fails to make assumptions about this method.
2022-06-07 14:53:59 -04:00
Michael Howell
1e6a85789e
rustdoc: show auto/blanket docs for tuple and unit
2022-06-07 11:25:00 -07:00
Dan Gohman
f9662f2c18
Update library/std/src/os/unix/io/mod.rs
...
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-06-07 11:16:32 -07:00
Dan Gohman
27d9ab447b
Update library/std/src/os/unix/io/mod.rs
...
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-06-07 10:38:31 -07:00
Dan Gohman
52cb18b664
Update library/std/src/os/unix/io/mod.rs
...
Co-authored-by: Sean Stangl <sean.stangl@gmail.com>
2022-06-07 09:53:34 -07:00
Dan Gohman
fbb59e7062
Update library/std/src/os/unix/io/mod.rs
...
Co-authored-by: Sean Stangl <sean.stangl@gmail.com>
2022-06-07 09:53:26 -07:00