Commit Graph

8128 Commits

Author SHA1 Message Date
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
Michael Goulet
5dccf4e5fc
Rollup merge of #97950 - eggyal:issue-97945, r=Dylan-DPC
Clarify `#[derive(PartialEq)]` on enums

Fixes #97945
2022-06-12 17:35:41 -07: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
Dylan DPC
b2172b7a53
Rollup merge of #97921 - bvanjoi:docs-example-str-replace, r=Dylan-DPC
additional docs example for replace **all** of str
2022-06-12 12:14:26 +02:00
bors
c08b235a5c Auto merge of #97996 - matthiaskrgr:rollup-bvbjlid, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #97904 (Small grammar fix in the compile_error documentation)
 - #97943 (line 1352, change `self` to `*self`, other to `*other`)
 - #97969 (Make -Cpasses= only apply to pre-link optimization)
 - #97990 (Add more eslint checks)
 - #97994 (feat(fix): update some links in `hir.rs`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-11 17:49:22 +00:00
Matthias Krüger
39de4e4b6f
Rollup merge of #97943 - Warrenren:master, r=Dylan-DPC
line 1352, change `self` to `*self`, other to `*other`

The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know.
2022-06-11 18:05:33 +02:00
Matthias Krüger
4b7ec84c31
Rollup merge of #97904 - est31:master, r=Dylan-DPC
Small grammar fix in the compile_error documentation
2022-06-11 18:05:32 +02:00
Mara Bos
ae0a533b0b Stabilize scoped threads. 2022-06-11 15:01:52 +02:00
Dylan DPC
54d7b3fb9c
Rollup merge of #97979 - ben0x539:providerdocs, r=Dylan-DPC
Fix typos in Provider API docs
2022-06-11 12:59:29 +02:00
Dylan DPC
5dc8f1799e
Rollup merge of #97958 - mkroening:exit-status-docs, r=Dylan-DPC
ExitStatus docs fixups

This fixes a typo, adds a link and adds code-quotes in the ExitStatus docs.
2022-06-11 07:42:15 +02:00
Benjamin Herr
74ef14830f Fix typos in Provider API docs 2022-06-10 20:58:27 -07:00
Warrenren
9e1e476186
Update cmp.rs
line 1352, delete parentheses for reviewers asking for it.
2022-06-11 11:04:27 +08: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
Matthias Krüger
30a8903821
Rollup merge of #97940 - GuillaumeGomez:relative-link, r=Dylan-DPC
Use relative links instead of linking to doc.rust-lang.org when possible

Part of https://github.com/rust-lang/rust/issues/97918.
2022-06-10 22:32:31 +02: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
Alan Egerton
7bbf914078
Clarify #[derive(PartialEq)] on enums
Fixes #97945
2022-06-10 16:26:00 +01: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
Warrenren
5e9e73cc9f
line 1352, change self to (*self), other to (*other)
The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know.
2022-06-10 19:08:03 +08:00
Guillaume Gomez
28ca3bdeb2 Use relative links instead of linking to doc.rust-lang.org when possible 2022-06-10 11:57:53 +02:00
bors
f19ccc2e8d Auto merge of #97939 - JohnTitor:rollup-79pxupb, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #97718 (Fix `delayed_good_path_bug` ice for expected diagnostics (RFC 2383))
 - #97876 (update docs for `std::future::IntoFuture`)
 - #97888 (Don't use __gxx_personality_v0 in panic_unwind on emscripten target)
 - #97922 (Remove redundant calls to reserve in impl Write for VecDeque)
 - #97927 (Do not introduce bindings for types and consts in HRTB.)
 - #97937 (Fix a typo in `test/ui/hrtb/hrtb-just-for-static.rs`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-10 09:05:50 +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
Yuki Okushi
20be5da712
Rollup merge of #97888 - hoodmane:emscripten-eh-personality, r=Amanieu
Don't use __gxx_personality_v0 in panic_unwind on emscripten target

This resolves #85821. See also the discussion here:
https://github.com/emscripten-core/emscripten/issues/17128

The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.
2022-06-10 17:22:30 +09:00
Yuki Okushi
a652a4303f
Rollup merge of #97876 - yoshuawuyts:into-future-docs, r=JohnTitor,yaahc
update docs for `std::future::IntoFuture`

Ref https://github.com/rust-lang/rust/issues/67644.

This updates the docs for `IntoFuture` providing a bit more guidance on how to use it. Thanks!
2022-06-10 17:22:29 +09:00
bors
3dea0033f7 Auto merge of #95818 - petrochenkov:stabundle, r=wesleywiser
Stabilize the `bundle` native library modifier

And remove the legacy `static-nobundle` linking kind.

Stabilization report - https://github.com/rust-lang/rust/pull/95818#issuecomment-1120470945.

cc #81490
Closes #37403
2022-06-10 06:25:02 +00: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
bors
e9aff9c42c Auto merge of #91970 - nrc:provide-any, r=scottmcm
Add the Provider api to core::any

This is an implementation of [RFC 3192](https://github.com/rust-lang/rfcs/pull/3192) ~~(which is yet to be merged, thus why this is a draft PR)~~. It adds an API for type-driven requests and provision of data from trait objects. A primary use case is for the `Error` trait, though that is not implemented in this PR. The only major difference to the RFC is that the functionality is added to the `any` module, rather than being in a sibling `provide_any` module (as discussed in the RFC thread).

~~Still todo: improve documentation on items, including adding examples.~~

cc `@yaahc`
2022-06-10 01:10:59 +00:00
The 8472
2e62fdab76 use fcntl fallback for additional poll-specific errors 2022-06-10 01:36:50 +02:00
Vadim Petrochenkov
a8ee1f3a4f Stabilize the bundle native library modifier 2022-06-09 23:12:58 +04:00
Paolo Barbolini
c71e73eb61 Remove redundant calls to reserve in impl Write for VecDeque 2022-06-09 19:10:09 +02:00
Hood Chatham
d2d205d0a8 Add underscores to rust_eh_personality arguments to mark them as unused 2022-06-09 09:50:26 -07:00
bvanjoi
7c861cf0ad additional docs example for replace **all** of str 2022-06-10 00:28:46 +08:00
bors
a0411e2bfe Auto merge of #97910 - JohnTitor:rollup-gu3k0xl, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #95632 (impl Read and Write for VecDeque<u8>)
 - #95860 (Stabilize `$$` in Rust 1.63.0)
 - #97838 (hexagon: adapt test for upstream output changes)
 - #97843 (Relax mipsel-sony-psp's linker script)
 - #97874 (rewrite combine doc comment)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-09 12:58:25 +00:00
est31
97519bd202 Grammar fix in the compile_error documentation 2022-06-09 12:40:10 +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
bors
be16c6166f Auto merge of #97868 - ssomers:btree_from_sorted_iter, r=the8472
BTreeSet: avoid intermediate sorting when collecting sorted iterators

As [pointed out by droundy](https://users.rust-lang.org/t/question-about-btreeset-implementation/76427), an obvious optimization is to skip the first step introduced by #88448 (creation of a vector and sorting) and it's easy to do so for btree's own iterators. Also, exploit `from` in the examples.
2022-06-09 10:17:04 +00:00
Hood Chatham
46a3f0feb6 Remove __gxx_personality_v0 declaration 2022-06-08 16:31:21 -07:00
Michael Goulet
1577838151
Rollup merge of #97871 - ChayimFriedman2:vec-iterator-unimplemented, r=compiler-errors
Suggest using `iter()` or `into_iter()` for `Vec`

We cannot do that for `&Vec` because `#[rustc_on_unimplemented]` is limited (it does not clean generic instantiation for references, only for ADTs).

`@rustbot` label +A-diagnostics
2022-06-08 13:32:22 -07: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
Hood Chatham
0ec3174e3e Fix formatter 2022-06-08 10:25:18 -07:00
Hood Chatham
2ecbdc1b32 Don't use __gxx_personality_v0 in panic_unwind on emscripten target
This resolves #85821. See also the discussion here:
https://github.com/emscripten-core/emscripten/issues/17128

The consensus seems to be that rust_eh_personality is never invoked.
I patched __gxx_personality_v0 to log invocations and then ran
various panic tests and it was never called, so this analysis matches
what seems to happen in practice. This replaces the definition with
an abort, modeled on the structured exception handling implementation.
2022-06-08 10:04:02 -07:00
Matthias Krüger
ef56a1e9c9
Rollup merge of #97879 - hermitcore:condvar, r=Dylan-DPC
remove unneeded code

The init function isn't longer part of `Condvar`. Consequently, we removed the implementation for the target os `hermit`.
2022-06-08 18:15:05 +02:00
Stefan Lankes
85b5f74043 remove unneeded code 2022-06-08 15:35:49 +02:00
Yoshua Wuyts
a4c455080c update docs for std::future::IntoFuture 2022-06-08 15:21:16 +02:00
Yuki Okushi
2b58e6314a
Stabilize const_intrinsic_copy 2022-06-08 20:17:28 +09:00
Chayim Refael Friedman
456f1ffe12 Suggest using iter() or into_iter() for Vec
We cannot do that for `&Vec` because `#[rustc_on_unimplemented]` is limited (it does not clean generic instantiation for references, only for ADTs).
2022-06-08 11:09:08 +00:00
Stein Somers
49ccb7519f BTreeSet: avoid intermediate sorting when collecting sorted iterators 2022-06-08 12:42:31 +02:00