]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoAuto merge of #100024 - matthiaskrgr:rollup-36ab4wx, r=matthiaskrgr
bors [Mon, 1 Aug 2022 15:40:43 +0000 (15:40 +0000)]
Auto merge of #100024 - matthiaskrgr:rollup-36ab4wx, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #99340 (Fix ICE in Definitions::create_def)
 - #99629 (Improve `cannot move out of` error message)
 - #99864 (bootstrap: don't emit warn about duplicated deps with same/different features if some of sets actually empty)
 - #99911 (Remove some uses of `guess_head_span`)
 - #99976 (Make Rustdoc exit with correct error code when scraping examples from invalid files)
 - #100003 (Improve size assertions.)
 - #100012 (Avoid `Ty` to `String` conversions)
 - #100020 (better error when python is not found in x - issue #99648)

Failed merges:

 - #99994 (Replace `guess_head_span` with `opt_span`)

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoRollup merge of #100020 - CallumIO:issue-99648, r=jyn514
Matthias Krüger [Mon, 1 Aug 2022 14:49:35 +0000 (16:49 +0200)]
Rollup merge of #100020 - CallumIO:issue-99648, r=jyn514

better error when python is not found in x - issue #99648

`x` now shows an appropriate error message and exits, when a version of `python` is not found on the users `PATH`.

Resolves #99648

23 months agoRollup merge of #100012 - TaKO8Ki:avoid-ty-to-string-conversions, r=fee1-dead
Matthias Krüger [Mon, 1 Aug 2022 14:49:34 +0000 (16:49 +0200)]
Rollup merge of #100012 - TaKO8Ki:avoid-ty-to-string-conversions, r=fee1-dead

Avoid `Ty` to `String` conversions

follow-up to #98668

23 months agoRollup merge of #100003 - nnethercote:improve-size-assertions, r=lqd
Matthias Krüger [Mon, 1 Aug 2022 14:49:33 +0000 (16:49 +0200)]
Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqd

Improve size assertions.

- For any file with four or more size assertions, move them into a
  separate module (as is already done for `hir.rs`).
- Add some more for AST nodes and THIR nodes.
- Put the `hir.rs` ones in alphabetical order.

r? `@lqd`

23 months agoRollup merge of #99976 - willcrichton:example-analyzer, r=jyn514
Matthias Krüger [Mon, 1 Aug 2022 14:49:32 +0000 (16:49 +0200)]
Rollup merge of #99976 - willcrichton:example-analyzer, r=jyn514

Make Rustdoc exit with correct error code when scraping examples from invalid files

This PR fixes a small issue with the new Rustdoc scrape-examples feature. If a file that is being scraped has a type error, then currently that error is printed out, but the rustdoc process exits as if it succeeded. This is a problem for Cargo, which needs to track whether scraping succeeded (see rust-lang/cargo#10343).

This PR fixes the issue by checking whether an error is emitted, and aborting if so.

23 months agoRollup merge of #99911 - cjgillot:no-guess, r=davidtwco
Matthias Krüger [Mon, 1 Aug 2022 14:49:31 +0000 (16:49 +0200)]
Rollup merge of #99911 - cjgillot:no-guess, r=davidtwco

Remove some uses of `guess_head_span`

That function cuts a span at the first occurrence of `{`.  Using `def_span` is almost always more precise.

23 months agoRollup merge of #99864 - klensy:bootstrap-art-dupe, r=jyn514
Matthias Krüger [Mon, 1 Aug 2022 14:49:30 +0000 (16:49 +0200)]
Rollup merge of #99864 - klensy:bootstrap-art-dupe, r=jyn514

bootstrap: don't emit warn about duplicated deps with same/different features if some of sets actually empty

Example (https://github.com/rust-lang-ci/rust/runs/7551453940?check_suite_focus=true#step:25:15008):
```
 duplicate artifacts found when compiling a tool, this typically means that something was recompiled because a transitive dependency has different features activated than in a previous build:

the following dependencies are duplicated although they have the same features enabled:
the following dependencies have different features:
  memchr 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)
    `clippy-driver` additionally enabled features {} at "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-freebsd/release/deps/libmemchr-44aa6ff4f08e293f.rlib"
    `cargo` additionally enabled features {"use_std"} at "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-freebsd/release/deps/libmemchr-70e29af0fd3ef292.rlib"
```

Notice that no info printed under  `the following dependencies are duplicated although they have the same features enabled:`

23 months agoRollup merge of #99629 - obeis:issue-99470, r=compiler-errors
Matthias Krüger [Mon, 1 Aug 2022 14:49:28 +0000 (16:49 +0200)]
Rollup merge of #99629 - obeis:issue-99470, r=compiler-errors

Improve `cannot move out of` error message

Closes #99470
r? `@bjorn3`

23 months agoRollup merge of #99340 - GoldsteinE:fix-localdefid-debug-ice, r=lcnr
Matthias Krüger [Mon, 1 Aug 2022 14:49:27 +0000 (16:49 +0200)]
Rollup merge of #99340 - GoldsteinE:fix-localdefid-debug-ice, r=lcnr

Fix ICE in Definitions::create_def

`Debug` implementation for `LocalDefId` uses global `Definitions`. Normally it’s ok, but we can’t do it while holding a mutable reference to `Definitions`, since it causes ICE or deadlock (depending on whether `parallel_compiler` is enabled).

This PR effectively copies the `Debug` implementation into the problematic method. I don’t particularly love this solution (since it creates code duplication), but I don’t see any other options.

This issue was discovered when running `rustdoc` with `RUSTDOC_LOG=trace` on the following file:
```rust
pub struct SomeStruct;

fn asdf() {
    impl SomeStruct {
        pub fn qwop(&self) {
            println!("hidden function");
        }
    }
}
```

I’m not sure how to create a test for this behavior.

23 months agofix ICE in Definitions::create_def
Goldstein [Sat, 16 Jul 2022 18:30:17 +0000 (21:30 +0300)]
fix ICE in Definitions::create_def

23 months agoAuto merge of #99884 - nnethercote:lexer-improvements, r=matklad
bors [Mon, 1 Aug 2022 12:52:49 +0000 (12:52 +0000)]
Auto merge of #99884 - nnethercote:lexer-improvements, r=matklad

Lexer improvements

Some cleanups and small speed improvements.

r? `@matklad`

23 months agofix: better error when python not found in x
Callum Leslie [Mon, 1 Aug 2022 11:04:56 +0000 (12:04 +0100)]
fix: better error when python not found in x

chore: clean comments to be relevant

23 months agoMake Rustdoc exit with correct error code when scrape examples from invalid files
Will Crichton [Sun, 31 Jul 2022 04:12:04 +0000 (21:12 -0700)]
Make Rustdoc exit with correct error code when scrape examples from invalid files

23 months agoAuto merge of #98246 - joshtriplett:times, r=m-ou-se
bors [Mon, 1 Aug 2022 06:44:43 +0000 (06:44 +0000)]
Auto merge of #98246 - joshtriplett:times, r=m-ou-se

Support setting file accessed/modified timestamps

Add `struct FileTimes` to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add `File::set_file_time` to set the timestamps for a `File`.

Implement the `sys` backends for UNIX, macOS (which needs to fall back
to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
and WASI.

23 months agoAuto merge of #99944 - bjorn3:hide_proc_macro_symbols, r=eddyb
bors [Mon, 1 Aug 2022 03:58:52 +0000 (03:58 +0000)]
Auto merge of #99944 - bjorn3:hide_proc_macro_symbols, r=eddyb

Limit symbols exported from proc macros

Only `__rustc_proc_macro_decls_*__` and `rust_metadata_*` need to be
exported for proc macros to work. All other symbols only increase binary
size and have the potential to conflict with symbols from the host
compiler.

Fixes https://github.com/rust-lang/rust/issues/99909
Fixes #59998

cc `@eddyb`

23 months agoavoid `Ty` to `String` conversions
Takayuki Maeda [Mon, 1 Aug 2022 03:52:30 +0000 (12:52 +0900)]
avoid `Ty` to `String` conversions

23 months agoAuto merge of #99998 - matthiaskrgr:rollup-igafy0r, r=matthiaskrgr
bors [Mon, 1 Aug 2022 01:11:08 +0000 (01:11 +0000)]
Auto merge of #99998 - matthiaskrgr:rollup-igafy0r, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #99519 (Remove implicit names and values from `--cfg` in `--check-cfg`)
 - #99620 (`-Z location-detail`: provide option to disable all location details)
 - #99932 (Fix unwinding on certain platforms when debug assertions are enabled)
 - #99973 (Layout things)
 - #99980 (Remove more Clean trait implementations)
 - #99984 (Fix compat.rs for `cfg(miri)`)
 - #99986 (Add wrap suggestions for record variants)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoImprove size assertions.
Nicholas Nethercote [Sat, 30 Jul 2022 20:57:53 +0000 (06:57 +1000)]
Improve size assertions.

- For any file with four or more size assertions, move them into a
  separate module (as is already done for `hir.rs`).
- Add some more for AST nodes and THIR nodes.
- Put the `hir.rs` ones in alphabetical order.

23 months agoShrink `Token`.
Nicholas Nethercote [Wed, 27 Jul 2022 03:59:30 +0000 (13:59 +1000)]
Shrink `Token`.

From 72 bytes to 12 bytes (on x86-64).

There are two parts to this:
- Changing various source code offsets from 64-bit to 32-bit. This is
  not a problem because the rest of rustc also uses 32-bit source code
  offsets. This means `Token` is no longer `Copy` but this causes no
  problems.
- Removing the `RawStrError` from `LiteralKind`. Raw string literal
  invalidity is now indicated by a `None` value within
  `RawStr`/`RawByteStr`, and the new `validate_raw_str` function can be
  used to re-lex an invalid raw string literal to get the `RawStrError`.

There is one very small change in behaviour. Previously, if a raw string
literal matched both the `InvalidStarter` and `TooManyHashes` cases,
the latter would override the former. This has now changed, because
`raw_double_quoted_string` now uses `?` and so returns immediately upon
detecting the `InvalidStarter` case. I think this is a slight
improvement to report the earlier-detected error, and it explains the
change in the `test_too_many_hashes` test.

The commit also removes a couple of comments that refer to #77629 and
say that the size of these types don't affect performance. These
comments are wrong, though the performance effect is small.

23 months agoAdd a size assertion for `Token`.
Nicholas Nethercote [Wed, 27 Jul 2022 04:21:08 +0000 (14:21 +1000)]
Add a size assertion for `Token`.

23 months agoInline `TokenStreamBuilder::push`.
Nicholas Nethercote [Wed, 27 Jul 2022 05:13:15 +0000 (15:13 +1000)]
Inline `TokenStreamBuilder::push`.

Because it's small and hot.

23 months agoAvoid an unnecessary `return`.
Nicholas Nethercote [Wed, 27 Jul 2022 05:07:19 +0000 (15:07 +1000)]
Avoid an unnecessary `return`.

23 months agoInline `first_token`.
Nicholas Nethercote [Wed, 27 Jul 2022 03:50:48 +0000 (13:50 +1000)]
Inline `first_token`.

Because it's tiny and hot.

23 months agoRemove `StringReader::end_src_index`.
Nicholas Nethercote [Wed, 27 Jul 2022 02:50:22 +0000 (12:50 +1000)]
Remove `StringReader::end_src_index`.

It not needed, always being set to the end of the text.

23 months agoImprove shebang handling.
Nicholas Nethercote [Wed, 27 Jul 2022 02:15:35 +0000 (12:15 +1000)]
Improve shebang handling.

Avoid doing stuff until it's necessary.

23 months agoAuto merge of #99052 - tmiasko:bitset-clone-from, r=Mark-Simulacrum
bors [Sun, 31 Jul 2022 21:40:21 +0000 (21:40 +0000)]
Auto merge of #99052 - tmiasko:bitset-clone-from, r=Mark-Simulacrum

Fix cloning from a BitSet with a different domain size

The previous implementation incorrectly assumed that the
number of words in a bit set is equal to the domain size.

The new implementation delegates to `Vec::clone_from` which
is specialized for `Copy` elements.

Fixes #99006.

23 months agoRollup merge of #99986 - WaffleLapkin:record_struct_wrap_suggestion, r=compiler-errors
Matthias Krüger [Sun, 31 Jul 2022 21:39:44 +0000 (23:39 +0200)]
Rollup merge of #99986 - WaffleLapkin:record_struct_wrap_suggestion, r=compiler-errors

Add wrap suggestions for record variants

This PR adds a suggestions to wrap an expression in a record struct/variant when encountering mismatched types, similarly to a suggestion to wrap expression in a tuple struct that was added before.

An example:
```rust
struct B {
    f: u8,
}

enum E {
    A(u32),
    B { f: u8 },
}

fn main() {
    let _: B = 1;
    let _: E = 1;
}
```
```text
error[E0308]: mismatched types
  --> ./t.rs:11:16
   |
11 |     let _: B = 1;
   |            -   ^ expected struct `B`, found integer
   |            |
   |            expected due to this
   |
help: try wrapping the expression in `B`
   |
11 |     let _: B = B { f: 1 };
   |                ++++++   +

error[E0308]: mismatched types
  --> ./t.rs:12:16
   |
12 |     let _: E = 1;
   |            -   ^ expected enum `E`, found integer
   |            |
   |            expected due to this
   |
help: try wrapping the expression in a variant of `E`
   |
12 |     let _: E = E::A(1);
   |                +++++ +
12 |     let _: E = E::B { f: 1 };
   |                +++++++++   +
```

r? `@compiler-errors`

23 months agoRollup merge of #99984 - ChrisDenton:fix-miri, r=Mark-Simulacrum
Matthias Krüger [Sun, 31 Jul 2022 21:39:44 +0000 (23:39 +0200)]
Rollup merge of #99984 - ChrisDenton:fix-miri, r=Mark-Simulacrum

Fix compat.rs for `cfg(miri)`

Fixes #99982

23 months agoRollup merge of #99980 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC
Matthias Krüger [Sun, 31 Jul 2022 21:39:43 +0000 (23:39 +0200)]
Rollup merge of #99980 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC

Remove more Clean trait implementations

This time as well it allowed to remove a function.

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`

23 months agoRollup merge of #99973 - RalfJung:layout-things, r=eddyb
Matthias Krüger [Sun, 31 Jul 2022 21:39:42 +0000 (23:39 +0200)]
Rollup merge of #99973 - RalfJung:layout-things, r=eddyb

Layout things

These two commits are pretty independent, but didn't seem worth doing individual PRs for:
- Always check that size is a multiple of align, even without debug assertions
- Change Layout debug printing to put `variants` last, since it often huge and not usually the part we are most interested in

Cc `@eddyb`

23 months agoRollup merge of #99932 - madsmtm:fix-unwinding-debug-assertions, r=Amanieu
Matthias Krüger [Sun, 31 Jul 2022 21:39:41 +0000 (23:39 +0200)]
Rollup merge of #99932 - madsmtm:fix-unwinding-debug-assertions, r=Amanieu

Fix unwinding on certain platforms when debug assertions are enabled

This came up on `armv7-apple-ios` when using `-Zbuild-std`.

Looks like this is a leftover from a [conversion from C to Rust](051c2d14fb1e73866376668088971605d38f0c65), where integer wrapping is implicit.

Not at all sure how the unwinding code works!

23 months agoRollup merge of #99620 - hudson-ayers:fix-location-detail, r=davidtwco
Matthias Krüger [Sun, 31 Jul 2022 21:39:40 +0000 (23:39 +0200)]
Rollup merge of #99620 - hudson-ayers:fix-location-detail, r=davidtwco

`-Z location-detail`: provide option to disable all location details

As reported [here](https://github.com/rust-lang/rust/pull/89920#issuecomment-1190598924), when I first implemented the `-Z location-detail` flag there was a bug, where passing an empty list was not correctly supported, and instead rejected by the compiler. This PR fixes that such that passing an empty list results in no location details being tracked, as originally specified in https://github.com/rust-lang/rfcs/pull/2091 .

This PR also adds a test case to verify that this option continues to work as intended.

23 months agoRollup merge of #99519 - Urgau:check-cfg-implicit, r=petrochenkov
Matthias Krüger [Sun, 31 Jul 2022 21:39:38 +0000 (23:39 +0200)]
Rollup merge of #99519 - Urgau:check-cfg-implicit, r=petrochenkov

Remove implicit names and values from `--cfg` in `--check-cfg`

This PR remove the implicit names and values from `--cfg` in `--check-cfg` because the behavior is quite surprising but also because it's really easy to inadvertently really on the implicitness and when the `--cfg` is not set anymore to have an unexpected warning from an unexpected condition that pass with the implicitness.

This change in behavior will also enable us to warn when an unexpected `--cfg` is passed, ex: the user wrote `--cfg=unstabl` instead of `--cfg=unstable`. The implementation of the warning will be done in a follow-up PR.

cc `@petrochenkov`

23 months agoAuto merge of #99988 - rylev:allow-try-perf, r=Mark-Simulacrum
bors [Sun, 31 Jul 2022 18:59:10 +0000 (18:59 +0000)]
Auto merge of #99988 - rylev:allow-try-perf, r=Mark-Simulacrum

Allow try-perf branch to run in CI

We want to be able to build artifacts through the try-perf branch but without this change the CI fails early.

r? `@Mark-Simulacrum`

23 months agoImprove `cannot move out of` error message
Obei Sideg [Fri, 22 Jul 2022 21:35:35 +0000 (00:35 +0300)]
Improve `cannot move out of` error message

23 months agoAllow try-perf branch to run in CI
Ryan Levick [Sun, 31 Jul 2022 16:53:34 +0000 (18:53 +0200)]
Allow try-perf branch to run in CI

23 months agoMake sure `symbol_name` is const evaluated
Chris Denton [Sun, 31 Jul 2022 14:07:47 +0000 (15:07 +0100)]
Make sure `symbol_name` is const evaluated

23 months agoAuto merge of #78802 - faern:simplify-socketaddr, r=joshtriplett
bors [Sun, 31 Jul 2022 15:56:28 +0000 (15:56 +0000)]
Auto merge of #78802 - faern:simplify-socketaddr, r=joshtriplett

Implement network primitives with ideal Rust layout, not C system layout

This PR is the result of this internals forum thread: https://internals.rust-lang.org/t/why-are-socketaddrv4-socketaddrv6-based-on-low-level-sockaddr-in-6/13321.

Instead of basing `std:::net::{Ipv4Addr, Ipv6Addr, SocketAddrV4, SocketAddrV6}` on system (C) structs, they are encoded in a more optimal and idiomatic Rust way.

This changes the public API of std by introducing structural equality impls for all four types here, which means that `match ipv4addr { SOME_CONSTANT => ... }` will now compile, whereas previously this was an error. No other intentional changes are introduced to public API.

It's possible to observe the current layout of these types (e.g., by pointer casting); most but not all libraries which were found by Crater to do this have had updates issued and affected versions yanked. See report below.

### Benefits of this change

- It will become possible to move these fundamental network types from `std` into `core` ([RFC](https://github.com/rust-lang/rfcs/pull/2832)).
- Some methods that can't be made `const fn`s today can be made `const fn`s with this change.
- `SocketAddrV4` only occupies 6 bytes instead of 16 bytes.
- These simple primitives become easier to read and uses less `unsafe`.
- Makes these types support structural equality, which means you can now (for instance) match an `Ipv4Addr` against a constant

### ~Remaining~ Previous problems

This change obviously changes the memory layout of the types. And it turns out some libraries invalidly assumes the memory layout and does very dangerous pointer casts to convert them. These libraries will have undefined behaviour and perform invalid memory access until patched.

- [x] - `mio` - Issue: https://github.com/tokio-rs/mio/issues/1386.
  - [x] `0.7` branch https://github.com/tokio-rs/mio/pull/1388
  - [x] `0.7.6` published https://github.com/tokio-rs/mio/pull/1398
  - [x] Yank all `0.7` versions older than `0.7.6`
  - [x] Report `<0.7.6` to RustSec Advisory Database https://rustsec.org/advisories/RUSTSEC-2020-0081.html
- [x] - `socket2` - Issue: https://github.com/rust-lang/socket2-rs/issues/119.
  - [x] `0.3.x` branch https://github.com/rust-lang/socket2-rs/pull/120
  - [x] `0.3.16` published
  - [x] `master` branch https://github.com/rust-lang/socket2-rs/pull/122
  - [x] Yank all `0.3` versions older than `0.3.16`
  - [x] Report `<0.3.16` to RustSec Advisory Database https://rustsec.org/advisories/RUSTSEC-2020-0079.html
- [x] - `net2` - Issue: https://github.com/deprecrated/net2-rs/issues/105
  - [x] https://github.com/deprecrated/net2-rs/pull/106
  - [x] `0.2.36` published
  - [x] Yank all `0.2` versions older than `0.2.36`
  - [x] Report `<0.2.36` to RustSec Advisory Database https://rustsec.org/advisories/RUSTSEC-2020-0078.html
- [x] - `miow` - Issue: https://github.com/yoshuawuyts/miow/issues/38
  - [x] `0.3.x` - https://github.com/yoshuawuyts/miow/pull/39
  - [x] `0.3.6` published
  - [x] `0.2.x` - https://github.com/yoshuawuyts/miow/pull/40
  - [x] `0.2.2` published
  - [x] Yanked all `0.2` versions older than `0.2.2`
  - [x] Yanked all `0.3` versions older than `0.3.6`
  - [x] Report `<0.2.2` and `<0.3.6` to RustSec Advisory Database https://rustsec.org/advisories/RUSTSEC-2020-0080.html
- [x] - `quinn master` (aka what became 0.7) - https://github.com/quinn-rs/quinn/issues/968 https://github.com/quinn-rs/quinn/pull/987
  - [x] - `quinn 0.6` - https://github.com/quinn-rs/quinn/pull/1045
  - [x] - `quinn 0.5` - https://github.com/quinn-rs/quinn/pull/1046
  - [x] - Release `0.7.0`, `0.6.2` and `0.5.4`
- [x] - `nb-connect` - https://github.com/smol-rs/nb-connect/issues/1
  - [x] - Release `1.0.3`
  - [x] - Yank all versions older than `1.0.3`
- [x] - `shadowsocks-rust` - https://github.com/shadowsocks/shadowsocks-rust/issues/462
- [ ] - `rio` - https://github.com/spacejam/rio/issues/44
- [ ] - `seaslug` - https://github.com/spacejam/seaslug/issues/1

#### Fixed crate versions

All crates I have found that assumed the memory layout have been fixed and published. The crates and versions that will continue working even as/if this PR is merged is (please upgrade these to help unblock this PR):

* `net2 0.2.36`
* `socket2 0.3.16`
* `miow 0.2.2`
* `miow 0.3.6`
* `mio 0.7.6`
* `mio 0.6.23` - Never had the invalid assumption itself, but has now been bumped to only allow fixed dependencies (`net2` + `miow`)
* `nb-connect 1.0.3`
* `quinn 0.5.4`
* `quinn 0.6.2`

### Release notes draft

This release changes the memory layout of `Ipv4Addr`, `Ipv6Addr`, `SocketAddrV4` and `SocketAddrV6`. The standard library no longer implements these as the corresponding `libc` structs (`sockaddr_in`, `sockaddr_in6` etc.). This internal representation was never exposed, but some crates relied on it anyway by unsafely transmuting. This change will cause those crates to make invalid memory accesses. Notably `net2 <0.2.36`, `socket2 <0.3.16`, `mio <0.7.6`, `miow <0.3.6` and a few other crates are affected. All known affected crates have been patched and have had fixed versions published over a year ago. If any affected crate is still in your dependency tree, you need to upgrade them before using this version of Rust.

23 months agoSkip unstable fields when suggesting wrapping expression in structs
Maybe Waffle [Sun, 31 Jul 2022 15:12:53 +0000 (19:12 +0400)]
Skip unstable fields when suggesting wrapping expression in structs

23 months ago--bless tests
Maybe Waffle [Sun, 31 Jul 2022 14:09:39 +0000 (18:09 +0400)]
--bless tests

23 months agoRefactor wrap suggestion code (just a bit)
Maybe Waffle [Sun, 31 Jul 2022 13:53:47 +0000 (17:53 +0400)]
Refactor wrap suggestion code (just a bit)

23 months agoFix compat.rs for `cfg(miri)`
Chris Denton [Sun, 31 Jul 2022 13:45:26 +0000 (14:45 +0100)]
Fix compat.rs for `cfg(miri)`

23 months agoSuggest wrapping expressions in single-field record variants
Maybe Waffle [Sun, 31 Jul 2022 13:38:28 +0000 (17:38 +0400)]
Suggest wrapping expressions in single-field record variants

23 months agoAuto merge of #99979 - Dylan-DPC:rollup-ikkejgy, r=Dylan-DPC
bors [Sun, 31 Jul 2022 13:26:27 +0000 (13:26 +0000)]
Auto merge of #99979 - Dylan-DPC:rollup-ikkejgy, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #99186 (Use LocalDefId for closures more)
 - #99741 (Use `impl`'s generics when suggesting fix on bad `impl Copy`)
 - #99844 (Introduce an ArchiveBuilderBuilder)
 - #99921 (triagebot.yml: CC Enselic when rustdoc-json-types changes)
 - #99974 (Suggest removing a semicolon and boxing the expressions for if-else)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoRemove Clean trait implementation for hir::TypeBindingKind
Guillaume Gomez [Sun, 31 Jul 2022 12:24:13 +0000 (14:24 +0200)]
Remove Clean trait implementation for hir::TypeBindingKind

23 months agoreorder fields in Laout debug output
Ralf Jung [Sun, 31 Jul 2022 01:39:15 +0000 (21:39 -0400)]
reorder fields in Laout debug output

23 months agoRemove Clean trait implementation for hir::TypeBinding
Guillaume Gomez [Sun, 31 Jul 2022 12:21:07 +0000 (14:21 +0200)]
Remove Clean trait implementation for hir::TypeBinding

23 months agoRemove Clean trait implementation for hir::Path
Guillaume Gomez [Sun, 31 Jul 2022 12:17:23 +0000 (14:17 +0200)]
Remove Clean trait implementation for hir::Path

23 months agoRollup merge of #99974 - TaKO8Ki:suggest-removing-semicolon-and-boxing-the-expression...
Dylan DPC [Sun, 31 Jul 2022 12:06:44 +0000 (17:36 +0530)]
Rollup merge of #99974 - TaKO8Ki:suggest-removing-semicolon-and-boxing-the-expressions, r=compiler-errors

Suggest removing a semicolon and boxing the expressions for if-else

`InferCtxt::suggest_remove_semi_or_return_binding` was not working well, so I fixed it and added a ui test.

23 months agoRollup merge of #99921 - Enselic:cc-enselic, r=GuillaumeGomez
Dylan DPC [Sun, 31 Jul 2022 12:06:43 +0000 (17:36 +0530)]
Rollup merge of #99921 - Enselic:cc-enselic, r=GuillaumeGomez

triagebot.yml: CC Enselic when rustdoc-json-types changes

Being the maintainer of [cargo-public-api](https://github.com/Enselic/cargo-public-api) which relies on [rustdoc JSON](https://github.com/rust-lang/rust/issues/76578) means I have high stakes in the rustdoc JSON format itself. Would be great if I could be pinged when the format is about to change.

I hope this is OK. Big thanks in advance.

23 months agoRollup merge of #99844 - bjorn3:archive_builder_interface_refactor, r=nagisa
Dylan DPC [Sun, 31 Jul 2022 12:06:42 +0000 (17:36 +0530)]
Rollup merge of #99844 - bjorn3:archive_builder_interface_refactor, r=nagisa

Introduce an ArchiveBuilderBuilder

This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend. I'm going to use this in https://github.com/rust-lang/rust/pull/97485 to allow passing in the right function to extract symbols from object files to a generic archive builder to be used by cg_llvm, cg_clif and cg_gcc.

23 months agoRollup merge of #99741 - compiler-errors:copy-impl-impl-generics, r=fee1-dead
Dylan DPC [Sun, 31 Jul 2022 12:06:41 +0000 (17:36 +0530)]
Rollup merge of #99741 - compiler-errors:copy-impl-impl-generics, r=fee1-dead

Use `impl`'s generics when suggesting fix on bad `impl Copy`

See the UI test for a more complicated example, but we weren't correctly suggesting to add bounds given a manual `impl` whose generics didn't match the struct generics.

```rust
#[derive(Clone)]
struct Wrapper<T>(T);

impl<S> Copy for Wrapper<S> {}
```

Coincidentally this fix didn't cause any regressions for `derive(Copy)` impls, I think because those use the same spans in the impl generics as the struct generics, so the machinery still applies the same change.

23 months agoRollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot
Dylan DPC [Sun, 31 Jul 2022 12:06:40 +0000 (17:36 +0530)]
Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot

Use LocalDefId for closures more

23 months agoAuto merge of #99553 - ChrisDenton:lazy-compat-fn, r=Mark-Simulacrum
bors [Sun, 31 Jul 2022 10:44:11 +0000 (10:44 +0000)]
Auto merge of #99553 - ChrisDenton:lazy-compat-fn, r=Mark-Simulacrum

Rewrite Windows `compat_fn` macro

This allows using most delay loaded functions before the init code initializes them. It also only preloads a select few functions, rather than all functions.

This is optimized for the common case where a function is used after already being loaded (or failed to load). The only change in codegen at the call site is to use an atomic load instead of a plain load, which should have negligible or no impact.

I've split the old `compat_fn` macro in two so as not to mix two different use cases. If/when Windows 7 support is dropped `compat_fn_optional` can be removed entirely.

r? rust-lang/libs

23 months agoAdd issue reference
bjorn3 [Sun, 31 Jul 2022 10:10:58 +0000 (10:10 +0000)]
Add issue reference

23 months agoRemove workarounds for issue 59998
bjorn3 [Sun, 31 Jul 2022 10:03:44 +0000 (10:03 +0000)]
Remove workarounds for issue 59998

23 months agocheck 'size multiple of align' for all layouts
Ralf Jung [Thu, 28 Jul 2022 20:59:55 +0000 (16:59 -0400)]
check 'size multiple of align' for all layouts

23 months agoAuto merge of #99529 - Milo123459:stage-1-test, r=jyn514
bors [Sun, 31 Jul 2022 08:03:26 +0000 (08:03 +0000)]
Auto merge of #99529 - Milo123459:stage-1-test, r=jyn514

Run `x test --stage 1` in CI

Fixes #99135

r? `@jyn514`

23 months agoadd a test to check if `suggest_remove_semi_or_return_binding` is working well for...
Takayuki Maeda [Sun, 31 Jul 2022 02:36:04 +0000 (11:36 +0900)]
add a test to check if `suggest_remove_semi_or_return_binding` is working well for if-else

23 months agouse appropriate `HirID` for finding `else_span`
Takayuki Maeda [Sun, 31 Jul 2022 02:33:01 +0000 (11:33 +0900)]
use appropriate `HirID` for finding `else_span`

23 months agoAuto merge of #99959 - cuviper:niche-size, r=eddyb
bors [Sat, 30 Jul 2022 23:47:51 +0000 (23:47 +0000)]
Auto merge of #99959 - cuviper:niche-size, r=eddyb

Fix the size of niche enums with ZST alignment

For enums with an aligned ZST variant, like `[T; 0]`, the niche layout
was not computing a sufficient size to be consistent with alignment. Now
we pad that size up to the alignment, and also make sure to only use the
niche variant's ABI when the size and alignment still match.

Fixes #99836
r? `@eddyb`

23 months agodont run stage1 tests in pr
Milo [Sat, 30 Jul 2022 22:10:26 +0000 (22:10 +0000)]
dont run stage1 tests in pr

23 months agoadd to full test-suite
Milo [Sat, 30 Jul 2022 21:56:53 +0000 (21:56 +0000)]
add to full test-suite

23 months agoAuto merge of #99964 - matthiaskrgr:rollup-jr836e2, r=matthiaskrgr
bors [Sat, 30 Jul 2022 21:01:42 +0000 (21:01 +0000)]
Auto merge of #99964 - matthiaskrgr:rollup-jr836e2, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #99650 (Support `x --keep-stage 0 check`)
 - #99873 (rustdoc: align invalid-html-tags lint with commonmark spec)
 - #99889 (Remove `parent_pat` from `TopInfo`)
 - #99890 (Do not allow bad projection term to leak into the type checker)
 - #99937 (Reset directory iteration in remove_dir_all)
 - #99950 (Remove more Clean trait implementations)
 - #99956 (Also gate AllocatedPointer and AllocAlign definitions by LLVM_VERSION_GE)
 - #99962 (Discover channel for LLVM download)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoUse LocalDefId for closures more
Cameron Steffen [Tue, 12 Jul 2022 14:10:22 +0000 (09:10 -0500)]
Use LocalDefId for closures more

23 months agoRollup merge of #99962 - Mark-Simulacrum:detect-ci-artifact-channel, r=jyn514
Matthias Krüger [Sat, 30 Jul 2022 20:51:03 +0000 (22:51 +0200)]
Rollup merge of #99962 - Mark-Simulacrum:detect-ci-artifact-channel, r=jyn514

Discover channel for LLVM download

r? `@jyn514`
cc `@RalfJung`

Reported on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/No.20prebuilt.20LLVM.20for.20the.20beta.20branch.3F

23 months agoRollup merge of #99956 - est31:fix_llvm_wrapper_warning, r=cuviper
Matthias Krüger [Sat, 30 Jul 2022 20:51:02 +0000 (22:51 +0200)]
Rollup merge of #99956 - est31:fix_llvm_wrapper_warning, r=cuviper

Also gate AllocatedPointer and AllocAlign definitions by LLVM_VERSION_GE

Fixes a warning:

```
warning: llvm-wrapper/RustWrapper.cpp:159:11: warning: enumeration values 'AllocatedPointer' and 'AllocAlign' not handled in switch [-Wswitch]
warning:   switch (Kind) {
warning:           ^
```

Which was fall out from 130a1df71ea73ab9d66d3cb8fc9cdb43155d514b.

Fixes #99955

23 months agoRollup merge of #99950 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC
Matthias Krüger [Sat, 30 Jul 2022 20:51:01 +0000 (22:51 +0200)]
Rollup merge of #99950 - GuillaumeGomez:rm-clean-impls, r=Dylan-DPC

Remove more Clean trait implementations

This time it even allowed to remove a function.

Follow-up of https://github.com/rust-lang/rust/pull/99638.

r? `@notriddle`

23 months agoRollup merge of #99937 - ChrisDenton:fix-remove-dir-all-win-7, r=joshtriplett
Matthias Krüger [Sat, 30 Jul 2022 20:51:00 +0000 (22:51 +0200)]
Rollup merge of #99937 - ChrisDenton:fix-remove-dir-all-win-7, r=joshtriplett

Reset directory iteration in remove_dir_all

Fixes #99934

23 months agoRollup merge of #99890 - compiler-errors:issue-99828, r=lcnr
Matthias Krüger [Sat, 30 Jul 2022 20:50:59 +0000 (22:50 +0200)]
Rollup merge of #99890 - compiler-errors:issue-99828, r=lcnr

Do not allow bad projection term to leak into the type checker

Fixes #99828

23 months agoRollup merge of #99889 - compiler-errors:cleanup-ti, r=cjgillot
Matthias Krüger [Sat, 30 Jul 2022 20:50:58 +0000 (22:50 +0200)]
Rollup merge of #99889 - compiler-errors:cleanup-ti, r=cjgillot

Remove `parent_pat` from `TopInfo`

We can get the parent pat from the hir map.

23 months agoRollup merge of #99873 - notriddle:notriddle/invalid-html-tags-webcomponents, r=Guill...
Matthias Krüger [Sat, 30 Jul 2022 20:50:57 +0000 (22:50 +0200)]
Rollup merge of #99873 - notriddle:notriddle/invalid-html-tags-webcomponents, r=GuillaumeGomezp

rustdoc: align invalid-html-tags lint with commonmark spec

23 months agoRollup merge of #99650 - jyn514:keep-stage-check, r=Mark-Simulacrum
Matthias Krüger [Sat, 30 Jul 2022 20:50:56 +0000 (22:50 +0200)]
Rollup merge of #99650 - jyn514:keep-stage-check, r=Mark-Simulacrum

Support `x --keep-stage 0 check`

Stage 1 check has been supported since https://github.com/rust-lang/rust/pull/81064.
 https://github.com/rust-lang/rust/pull/81064 changed the error message for this, but I don't think there's any reason we should prevent using it.
I tested locally and `keep-stage` works fine.

r? `@Mark-Simulacrum`

23 months agoFix warnings in stubbed out set_times
Josh Triplett [Sat, 30 Jul 2022 20:28:17 +0000 (13:28 -0700)]
Fix warnings in stubbed out set_times

23 months agoDiscover channel for artifact download
Mark Rousskov [Sat, 30 Jul 2022 19:44:37 +0000 (15:44 -0400)]
Discover channel for artifact download

When we're downloading based on a CI commit, that can still be -beta- or even
-stable-, so we should lookup the channel it was built with.

23 months agoTest another enum niche with multiple ZST alignments
Josh Stone [Sat, 30 Jul 2022 18:54:15 +0000 (11:54 -0700)]
Test another enum niche with multiple ZST alignments

23 months agoFix the size of niche enums with ZST alignment
Josh Stone [Sat, 30 Jul 2022 17:45:48 +0000 (10:45 -0700)]
Fix the size of niche enums with ZST alignment

For enums with an aligned ZST variant, like `[T; 0]`, the niche layout
was not computing a sufficient size to be consistent with alignment. Now
we pad that size up to the alignment, and also make sure to only use the
niche variant's ABI when the size and alignment still match.

23 months agoAuto merge of #99948 - Dylan-DPC:rollup-ed5136t, r=Dylan-DPC
bors [Sat, 30 Jul 2022 17:30:50 +0000 (17:30 +0000)]
Auto merge of #99948 - Dylan-DPC:rollup-ed5136t, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #99311 (change maybe_body_owned_by to take local def id)
 - #99862 (Improve type mismatch w/ function signatures)
 - #99895 (don't call type ascription "cast")
 - #99900 (remove some manual hash stable impls)
 - #99903 (Add diagnostic when using public instead of pub)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoAlso gate AllocatedPointer and AllocAlign definitions by LLVM_VERSION_GE
est31 [Sat, 30 Jul 2022 16:53:51 +0000 (18:53 +0200)]
Also gate AllocatedPointer and AllocAlign definitions by LLVM_VERSION_GE

Fixes a warning:

warning: llvm-wrapper/RustWrapper.cpp:159:11: warning: enumeration values 'AllocatedPointer' and 'AllocAlign' not handled in switch [-Wswitch]
warning:   switch (Kind) {
warning:           ^

Which was fall out from 130a1df71ea73ab9d66d3cb8fc9cdb43155d514b.

23 months agoUpdate src/librustdoc/passes/html_tags.rs
Michael Howell [Sat, 30 Jul 2022 16:02:05 +0000 (09:02 -0700)]
Update src/librustdoc/passes/html_tags.rs

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
23 months agoRemove Clean trait implementation for hir::VariantData
Guillaume Gomez [Sat, 30 Jul 2022 15:48:06 +0000 (17:48 +0200)]
Remove Clean trait implementation for hir::VariantData

23 months agoRemove Clean trait implementation for ty::VariantDef
Guillaume Gomez [Sat, 30 Jul 2022 15:34:29 +0000 (17:34 +0200)]
Remove Clean trait implementation for ty::VariantDef

23 months agoRollup merge of #99903 - gimbles:pub, r=davidtwco
Dylan DPC [Sat, 30 Jul 2022 15:09:50 +0000 (20:39 +0530)]
Rollup merge of #99903 - gimbles:pub, r=davidtwco

Add diagnostic when using public instead of pub

Forwarding from https://github.com/rust-lang/rust/pull/99706

I accidentally broke something(??) in git and the commits in that PR are absolutely not what I did in that branch

Anyways, this is the PR for this now. Adding tests again in a minute.

cc `@davidtwco`

23 months agoRollup merge of #99900 - lcnr:hash-stable-fun, r=cjgillot
Dylan DPC [Sat, 30 Jul 2022 15:09:49 +0000 (20:39 +0530)]
Rollup merge of #99900 - lcnr:hash-stable-fun, r=cjgillot

remove some manual hash stable impls

23 months agoRollup merge of #99895 - compiler-errors:type-ascription-aint-cast, r=davidtwco
Dylan DPC [Sat, 30 Jul 2022 15:09:48 +0000 (20:39 +0530)]
Rollup merge of #99895 - compiler-errors:type-ascription-aint-cast, r=davidtwco

don't call type ascription "cast"

Noticed in #99885

23 months agoRollup merge of #99862 - WaffleLapkin:type_mismatch_fix, r=compiler-errors
Dylan DPC [Sat, 30 Jul 2022 15:09:47 +0000 (20:39 +0530)]
Rollup merge of #99862 - WaffleLapkin:type_mismatch_fix, r=compiler-errors

Improve type mismatch w/ function signatures

This PR makes use of `note: expected/found` (instead of labeling types in labels) in type mismatch with function signatures. Pros: it's easier to compare the signatures, cons: the error is a little more verbose now.

This is especially nice when
- The signatures differ in a small subset of parameters (same parameters are elided)
- The difference is in details, for example `isize` vs `usize` (there is a better chance that the types align)

Also this PR fixes the inconsistency in variable names in the edited code (`expected` and `found`).

A zulip thread from which this pr started: [[link]](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/Type.20error.20regression.3F.2E.2E.2E/near/289756602).

An example diagnostic:

<table>
<tr>
<th>this pr</th>
<th>nightly</th>
</tr>
<tr>
<td>

```text
error[E0631]: type mismatch in function arguments
  --> ./t.rs:4:12
   |
4  |     expect(&f);
   |     ------ ^^ expected due to this
   |     |
   |     required by a bound introduced by this call
...
10 | fn f(_: isize, _: u8, _: Vec<u32>) {}
   | ---------------------------------- found signature defined here
   |
   = note: expected function signature `fn(usize, _, Vec<u64>) -> _`
              found function signature `fn(isize, _, Vec<u32>) -> _`
note: required because of the requirements on the impl of `Trait` for `fn(isize, u8, Vec<u32>) {f}`
  --> ./t.rs:8:9
   |
8  | impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}
   |         ^^^^^     ^
   = note: required for the cast from `fn(isize, u8, Vec<u32>) {f}` to the object type `dyn Trait`
```

</td>
<td>

```text
error[E0631]: type mismatch in function arguments
  --> ./t.rs:4:12
   |
4  |     expect(&f);
   |     ------ ^^ expected signature of `fn(usize, u8, Vec<u64>) -> _`
   |     |
   |     required by a bound introduced by this call
...
10 | fn f(_: isize, _: u8, _: Vec<u32>) {}
   | ---------------------------------- found signature of `fn(isize, u8, Vec<u32>) -> _`
   |
note: required because of the requirements on the impl of `Trait` for `fn(isize, u8, Vec<u32>) {f}`
  --> ./t.rs:8:9
   |
8  | impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}
   |         ^^^^^     ^
   = note: required for the cast to the object type `dyn Trait`
```

</td>
</tr>
</table>

<details><summary>code</summary>
<p>

```rust
fn main() {
    fn expect(_: &dyn Trait) {}

    expect(&f);
}

trait Trait {}
impl<F> Trait for F where F: Fn(usize, u8, Vec<u64>) -> u8 {}

fn f(_: isize, _: u8, _: Vec<u32>) {}
```

</p>
</details>

r? `@compiler-errors`

23 months agoRollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot
Dylan DPC [Sat, 30 Jul 2022 15:09:46 +0000 (20:39 +0530)]
Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot

change maybe_body_owned_by to take local def id

Issue https://github.com/rust-lang/rust/issues/96341
r? `@cjgillot`

23 months agoAuto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov
bors [Sat, 30 Jul 2022 14:50:05 +0000 (14:50 +0000)]
Auto merge of #99887 - nnethercote:rm-TreeAndSpacing, r=petrochenkov

Remove `TreeAndSpacing`.

A `TokenStream` contains a `Lrc<Vec<(TokenTree, Spacing)>>`. But this is
not quite right. `Spacing` makes sense for `TokenTree::Token`, but does
not make sense for `TokenTree::Delimited`, because a
`TokenTree::Delimited` cannot be joined with another `TokenTree`.

This commit fixes this problem, by adding `Spacing` to `TokenTree::Token`,
changing `TokenStream` to contain a `Lrc<Vec<TokenTree>>`, and removing the
`TreeAndSpacing` typedef.

The commit removes these two impls:
- `impl From<TokenTree> for TokenStream`
- `impl From<TokenTree> for TreeAndSpacing`

These were useful, but also resulted in code with many `.into()` calls
that was hard to read, particularly for anyone not highly familiar with
the relevant types. This commit makes some other changes to compensate:
- `TokenTree::token()` becomes `TokenTree::token_{alone,joint}()`.
- `TokenStream::token_{alone,joint}()` are added.
- `TokenStream::delimited` is added.

This results in things like this:
```rust
TokenTree::token(token::Semi, stmt.span).into()
```
changing to this:
```rust
TokenStream::token_alone(token::Semi, stmt.span)
```
This makes the type of the result, and its spacing, clearer.

These changes also simplifies `Cursor` and `CursorRef`, because they no longer
need to distinguish between `next` and `next_with_spacing`.

r? `@petrochenkov`

23 months agoAuto merge of #99868 - yaahc:rustc-perf-bump, r=Mark-Simulacrum
bors [Sat, 30 Jul 2022 12:21:14 +0000 (12:21 +0000)]
Auto merge of #99868 - yaahc:rustc-perf-bump, r=Mark-Simulacrum

bump rustc-perf commit

split off from https://github.com/rust-lang/rust/pull/99431

needed to access bugfix from https://github.com/rust-lang/rustc-perf/pull/1366

23 months agoLimit symbols exported from proc macros
bjorn3 [Sat, 30 Jul 2022 12:16:33 +0000 (12:16 +0000)]
Limit symbols exported from proc macros

Only __rustc_proc_macro_decls_*__ and rust_metadata_* need to be
exported for proc macros to work. All other symbols only increase binary
size and have the potential to conflict with symbols from the host
compiler.

23 months agoAuto merge of #99796 - compiler-errors:issue-53475, r=oli-obk
bors [Sat, 30 Jul 2022 09:35:22 +0000 (09:35 +0000)]
Auto merge of #99796 - compiler-errors:issue-53475, r=oli-obk

use `check_region_obligations_and_report_errors` to avoid ICEs

If we don't call `process_registered_region_obligations` before `resolve_regions_and_report_errors` then we'll ICE if we have any region obligations, and `check_region_obligations_and_report_errors` just does both of these for us in a nice convenient function.

Fixes #53475

r? types

23 months agoAuto merge of #99768 - klensy:bump-deps-07-22, r=Mark-Simulacrum
bors [Sat, 30 Jul 2022 06:54:38 +0000 (06:54 +0000)]
Auto merge of #99768 - klensy:bump-deps-07-22, r=Mark-Simulacrum

update few deps

Updates few crates:

* openssl-src v111.18.0+1.1.1n -> v111.22.0+1.1.1q: fixes few CVE's (https://www.openssl.org/news/vulnerabilities-1.1.1.html: https://cve.org/CVERecord?id=CVE-2022-1292 https://cve.org/CVERecord?id=CVE-2022-2068 https://cve.org/CVERecord?id=CVE-2022-2097)

* openssl-probe v0.1.2 -> v0.1.5 updates ancient (2017) crate (https://github.com/alexcrichton/openssl-probe/compare/0.1.2...0.1.5). Adds support to search cert for additional platforms.

* indoc v1.0.3 -> v1.0.6 (https://github.com/dtolnay/indoc/compare/1.0.3...1.0.6) Nothing special changed, removes unindent v0.1.7

* bstr v0.2.13 -> v0.2.17 (https://github.com/BurntSushi/bstr/compare/0.2.13...0.2.17) Few speedups (https://github.com/BurntSushi/bstr/commit/8e659921312830b91d2a48aafa36fb1a49cba5bc, https://github.com/BurntSushi/bstr/commit/5fcef919adf1b84a960c87126decb0f3ef8c2e61) and bugfix (https://github.com/BurntSushi/bstr/commit/b2111b6bbf2c9a819fb1338aa81bd099874106a1)

* crc32fast v1.2.0 -> v1.3.2 (https://github.com/srijs/rust-crc32fast/compare/v1.2.0...v1.3.2) Speedup debug (https://github.com/srijs/rust-crc32fast/commit/e61ce6a39bbe9da495198a4037292ec299e8970f)

* diff v0.1.12 -> v0.1.13 (https://github.com/utkarshkukreti/diff.rs/compare/0.1.12...0.1.13) Few optimizations (https://github.com/utkarshkukreti/diff.rs/pull/16, https://github.com/utkarshkukreti/diff.rs/commit/0f0aa580f197af7dab9ab905568f70a2387e23bc)

* ignore v0.4.17 -> v0.4.18 (it's hard to get usable diff, but most notable perf change is https://github.com/BurntSushi/ripgrep/commit/a28e664abd0d8912e4a2d85039fe282b9d37b994)

* globset v0.4.5 -> v0.4.9

* regex v1.5.5 -> v1.5.6 few bugfixes (https://github.com/rust-lang/regex/blob/1.5.6/CHANGELOG.md#156-2022-05-20). There exist 1.6.0 version, but it's too fresh.

23 months agoReset directory iteration in remove_dir_all
Chris Denton [Sat, 30 Jul 2022 04:28:38 +0000 (05:28 +0100)]
Reset directory iteration in remove_dir_all

23 months agoAuto merge of #99123 - mystor:crossbeam_bridge, r=eddyb
bors [Sat, 30 Jul 2022 04:05:28 +0000 (04:05 +0000)]
Auto merge of #99123 - mystor:crossbeam_bridge, r=eddyb

proc_macro: use crossbeam channels for the proc_macro cross-thread bridge

This is done by having the crossbeam dependency inserted into the `proc_macro` server code from the server side, to avoid adding a dependency to `proc_macro`.

In addition, this introduces a -Z command-line option which will switch rustc to run proc-macros using this cross-thread executor. With the changes to the bridge in #98186, #98187, #98188 and #98189, the performance of the executor should be much closer to same-thread execution.

In local testing, the crossbeam executor was substantially more performant than either of the two existing `CrossThread` strategies, so they have been removed to keep things simple.

r? `@eddyb`

23 months agoFix unwinding when debug assertions are enabled
Mads Marquart [Sat, 30 Jul 2022 03:11:00 +0000 (05:11 +0200)]
Fix unwinding when debug assertions are enabled

This came up on armv7-apple-ios when using -Zbuild-std

23 months agoRemove socklen_t from platforms where it's no longer used
Linus Färnstrand [Sun, 24 Jul 2022 16:27:19 +0000 (18:27 +0200)]
Remove socklen_t from platforms where it's no longer used

23 months agoAuto merge of #99925 - JohnTitor:rollup-4bt9ou3, r=JohnTitor
bors [Sat, 30 Jul 2022 00:26:22 +0000 (00:26 +0000)]
Auto merge of #99925 - JohnTitor:rollup-4bt9ou3, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #99227 (Fix thumbv4t-none-eabi frame pointer setting)
 - #99518 (Let-else: break out scopes when a let-else pattern fails to match)
 - #99671 (Suggest dereferencing index when trying to use a reference of usize as index)
 - #99831 (Add Fuchsia platform support documentation)
 - #99881 (fix ICE when computing codegen_fn_attrs on closure with non-fn parent)
 - #99888 (Streamline lint checking)
 - #99891 (Adjust an expr span to account for macros)
 - #99904 (Cleanup html whitespace)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

23 months agoDon't give a hard error for `x check --keep-stage 0`
Joshua Nelson [Sat, 23 Jul 2022 19:47:05 +0000 (14:47 -0500)]
Don't give a hard error for `x check --keep-stage 0`

Stage 1 check has been supported since https://github.com/rust-lang/rust/pull/81064.
 #81064 changed the error message for this, but I don't think there's any reason we should prevent using it.
I tested locally and `keep-stage` works fine. Don't give a hard error when trying to use it.

23 months agoRollup merge of #99904 - GuillaumeGomez:cleanup-html-whitespace, r=notriddle
Yuki Okushi [Fri, 29 Jul 2022 22:39:56 +0000 (07:39 +0900)]
Rollup merge of #99904 - GuillaumeGomez:cleanup-html-whitespace, r=notriddle

Cleanup html whitespace

I realized while looking at the raw HTML that we generated some unwanted white space characters. This PR cleans up the one coming directly from rustdoc. I'll check from `pulldown-cmark` for the remaining ones.

Some numbers now: the difference is small, it goes from `63009` to `62859`. But multiplied by the number of files, it becomes quite interesting overall.

r? `@notriddle`

23 months agoRollup merge of #99891 - compiler-errors:suggest-slicing-carefully, r=oli-obk
Yuki Okushi [Fri, 29 Jul 2022 22:39:55 +0000 (07:39 +0900)]
Rollup merge of #99891 - compiler-errors:suggest-slicing-carefully, r=oli-obk

Adjust an expr span to account for macros

Fix this erroneous suggestion:

```
error[E0529]: expected an array or slice, found `Vec<{integer}>`
 --> /home/gh-compiler-errors/test.rs:2:9
  |
2 |     let [..] = vec![1, 2, 3];
  |         ^^^^ pattern cannot match with input type `Vec<{integer}>`
  |
help: consider slicing here
 --> /home/gh-compiler-errors/rust2/library/alloc/src/macros.rs:50:36
  |
50~         $crate::__rust_force_expr!(<[_]>::into_vec(
51+             #[rustc_box]
52+             $crate::boxed::Box::new([$($x),+])
53~         )[..])
```