about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2022-06-14Rollup merge of #98042 - DrMeepster:winfred_std_changes, r=ChrisDentonDylan DPC-8/+10
Fix compat_fn option method on miri This change is required to make `WaitOnAddress` work with rust-lang/miri#2231
2022-06-13Use a private type definition to reduce cfg noiseMark Drobnak-36/+16
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
2022-06-13Enable thread_local_dtor on horizon OSIan Chamberlain-1/+1
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
2022-06-13Update libc::stat field namesIan Chamberlain-7/+12
See https://github.com/Meziu/rust-horizon/pull/14
2022-06-13Enable argv support for horizon OSIan Chamberlain-4/+7
See https://github.com/Meziu/rust-horizon/pull/9
2022-06-13Use the right wait_timeout implementationAzureMarker-7/+7
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.
2022-06-13Lower listen backlog to fix accept crashesAzureMarker-6/+13
See https://github.com/Meziu/rust-horizon/pull/1
2022-06-13Horizon OS STD supportMeziu-66/+286
Co-authored-by: Ian Chamberlain <ian.h.chamberlain@gmail.com> Co-authored-by: Mark Drobnak <mark.drobnak@gmail.com>
2022-06-13add inline(always) to optionDrMeepster-0/+1
2022-06-13fix broken doc commentJane Lusby-9/+10
2022-06-13remove outdated referencesJane Lusby-2/+1
2022-06-13Add provider API to error traitJane Lusby-1/+116
2022-06-13[perf] std: add missing `#[inline]` to `DefaultHasher::{new,default}`.Eduard-Mihai Burtescu-0/+2
2022-06-13Auto merge of #98038 - TaKO8Ki:remove-unnecessary-space-in-doc, ↵bors-1/+1
r=compiler-errors Remove an unnecessary space in doc
2022-06-13remove an unnecessary space in docTakayuki Maeda-1/+1
2022-06-12Rollup merge of #97992 - m-ou-se:stabilize-scoped-threads, r=joshtriplettDylan DPC-10/+12
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-12Rollup merge of #97970 - dtolnay:terminate, r=joshtriplettDylan DPC-1/+3
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-11Update library/std/src/primitive_docs.rsMichael Howell-1/+1
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2022-06-11fix compat_fn option method on miriDrMeepster-8/+9
2022-06-11Add test case for #trait-implementations-1 linkMichael Howell-0/+2
2022-06-11Re-add explicit list of traits to tuple docs, with limit notesMichael Howell-5/+34
2022-06-11Use relative path for addressing things in rust-lang/rustMichael Howell-2/+2
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2022-06-11Fix incorrectly spelled "variadic"Michael Howell-2/+2
2022-06-11Stabilize scoped threads.Mara Bos-10/+12
2022-06-10Do not panic in Termination impl on closed stderrDavid Tolnay-1/+3
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-10net listen backlog set to negative on Linux.David Carlier-2/+10
it will be 4076 (from 5.4) or 128.
2022-06-10docs: Consistently mark ExitStatus as codeMartin Kröning-2/+2
2022-06-10docs: Link to ExitCode instead of ExitStatus in ExitStatusMartin Kröning-2/+2
2022-06-10docs: Fix typo in ExitStatusMartin Kröning-1/+1
2022-06-10Make "windows_process_exit_code_from" unstableAron Parker-3/+3
2022-06-10Incorporate warning for potential exit code ambiguitiesAron Parker-0/+4
2022-06-10Fix copy paste errorAron Parker-1/+1
2022-06-10Auto merge of #96837 - tmiasko:stdio-fcntl, r=joshtriplettbors-35/+57
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-10Rollup merge of #97922 - paolobarbolini:no-vecdeque-extra-reserve, r=the8472Yuki Okushi-2/+0
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-10Auto merge of #95770 - nrc:read-buf-builder, r=joshtriplettbors-7/+11
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-10use fcntl fallback for additional poll-specific errorsThe 8472-7/+8
2022-06-09add cgroupv1 support to available_parallelismThe 8472-48/+128
2022-06-09Avoid `thread::panicking()` in non-poisoning methods of `Mutex` and `RwLock`Josh Stone-8/+15
`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-09Remove redundant calls to reserve in impl Write for VecDequePaolo Barbolini-2/+0
2022-06-09Implement ExitCodeExt for WindowsAron Parker-0/+41
2022-06-09Implement `fmt::Write` for `OsString`Tobias Bucher-0/+8
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-09Rollup merge of #95632 - evanrichter:master, r=joshtriplettYuki Okushi-0/+48
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-08Fix bootstrap attrMichael Howell-2/+2
2022-06-08rustdoc: fixed messed-up rustdoc auto trait implsMichael Howell-1/+1
Before: impl<T, U> UnwindSafe for (T, ...) where T: UnwindSafe, U: UnwindSafe, After: impl<T> UnwindSafe for (T, ...) where T: UnwindSafe,
2022-06-08rustdoc: show tuple impls as `impl Trait for (T, ...)`Michael Howell-18/+7
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-08Fix FFI-unwind unsoundness with mixed panic modeGary Guo-0/+2
2022-06-08Rollup merge of #97830 - LucasDumont:add-example-alloc, r=yaahcMichael Goulet-0/+14
Add std::alloc::set_alloc_error_hook example
2022-06-08Fix trailing whitespace.Dan Gohman-1/+1
2022-06-08Reword the question in the section header too.Dan Gohman-2/+2
This adopts the wording suggested in https://github.com/rust-lang/rust/pull/97837#discussion_r892524129.
2022-06-08Update library/std/src/os/unix/io/mod.rsDan Gohman-3/+2
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>