| Age | Commit message (Collapse) | Author | Lines |
|
Fix compat_fn option method on miri
This change is required to make `WaitOnAddress` work with rust-lang/miri#2231
|
|
I checked with t-libs to make sure this is OK to do on stable functions:
https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Replacing.20std.20function.20arg.20type.20with.20private.20type.20def.3F
|
|
Always use fallback thread_local destructor, since __cxa_thread_atexit_impl
is never defined on the target.
See https://github.com/AzureMarker/rust-horizon/pull/2
|
|
See https://github.com/Meziu/rust-horizon/pull/14
|
|
See https://github.com/Meziu/rust-horizon/pull/9
|
|
Our condvar doesn't support setting attributes, like
pthread_condattr_setclock, which the current wait_timeout expects to
have configured.
Switch to a different implementation, following espidf.
|
|
See https://github.com/Meziu/rust-horizon/pull/1
|
|
Co-authored-by: Ian Chamberlain <ian.h.chamberlain@gmail.com>
Co-authored-by: Mark Drobnak <mark.drobnak@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
r=compiler-errors
Remove an unnecessary space in doc
|
|
|
|
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
|
|
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
.
.
.
.
.
.
.
.
.
.
```
|
|
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
|
|
|
|
|
|
|
|
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
|
|
|
|
|
|
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
.
.
.
.
.
.
.
.
.
.
|
|
it will be 4076 (from 5.4) or 128.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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)
|
|
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
|
|
|
|
|
|
`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.
|
|
|
|
|
|
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());
```
|
|
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.
|
|
|
|
Before:
impl<T, U> UnwindSafe for (T, ...) where
T: UnwindSafe,
U: UnwindSafe,
After:
impl<T> UnwindSafe for (T, ...) where
T: UnwindSafe,
|
|
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.
|
|
|
|
Add std::alloc::set_alloc_error_hook example
|
|
|
|
This adopts the wording suggested in
https://github.com/rust-lang/rust/pull/97837#discussion_r892524129.
|
|
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
|