]> git.lizzy.rs Git - rust.git/log
rust.git
23 months agoAuto merge of #12916 - Veykril:nits, r=Veykril
bors [Sun, 31 Jul 2022 17:42:10 +0000 (17:42 +0000)]
Auto merge of #12916 - Veykril:nits, r=Veykril

minor: Properly cfg the `max` field of Limit

23 months agoGive variables more descriptive names
Lukas Wirth [Sun, 31 Jul 2022 17:27:34 +0000 (19:27 +0200)]
Give variables more descriptive names

23 months agoProperly cfg the `max` field of Limit
Lukas Wirth [Sun, 31 Jul 2022 17:27:20 +0000 (19:27 +0200)]
Properly cfg the `max` field of Limit

23 months agoUpdate xtask promote and release instructions
Laurențiu Nicola [Sun, 31 Jul 2022 17:26:35 +0000 (20:26 +0300)]
Update xtask promote and release instructions

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 agoAlways include a position span in rustc_parse_format::Argument
Alex Macleod [Sun, 31 Jul 2022 15:11:00 +0000 (15:11 +0000)]
Always include a position span in rustc_parse_format::Argument

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 #12913 - Veykril:attr-merge, r=Veykril
bors [Sat, 30 Jul 2022 07:53:48 +0000 (07:53 +0000)]
Auto merge of #12913 - Veykril:attr-merge, r=Veykril

fix: Fix ast-id up when merging raw attributes

Fixes https://github.com/rust-lang/rust-analyzer/issues/12912

23 months agofix: Fix ast-id up when merging raw attributes
Lukas Wirth [Sat, 30 Jul 2022 07:43:30 +0000 (09:43 +0200)]
fix: Fix ast-id up when merging raw attributes

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 agoparallelize HTML checking tool
Alex Gaynor [Sat, 30 Jul 2022 03:26:00 +0000 (23:26 -0400)]
parallelize HTML checking tool

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~         )[..])
```

23 months agoRollup merge of #99888 - nnethercote:streamline-visitors, r=cjgillot
Yuki Okushi [Fri, 29 Jul 2022 22:39:54 +0000 (07:39 +0900)]
Rollup merge of #99888 - nnethercote:streamline-visitors, r=cjgillot

Streamline lint checking

The early (AST) and late (HIR) lint checkers have a number of functions that aren't used by rustc or clippy. Might as well remove them -- it's not like there's a canonical API here, as shown by the ad hoc use of `check_foo`/`check_foo_post` combinations.

r? `@cjgillot`

23 months agoRollup merge of #99881 - compiler-errors:issue-99876, r=tmiasko
Yuki Okushi [Fri, 29 Jul 2022 22:39:53 +0000 (07:39 +0900)]
Rollup merge of #99881 - compiler-errors:issue-99876, r=tmiasko

fix ICE when computing codegen_fn_attrs on closure with non-fn parent

Other call sites check `has_codegen_attrs` first, so let's do that too.

Fixes #99876

23 months agoRollup merge of #99831 - djkoloski:add_fuchsia_target_documentation, r=tmandry
Yuki Okushi [Fri, 29 Jul 2022 22:39:52 +0000 (07:39 +0900)]
Rollup merge of #99831 - djkoloski:add_fuchsia_target_documentation, r=tmandry

Add Fuchsia platform support documentation

This documentation contains instructions for building and running binaries on Fuchsia using its provided SDK.

23 months agoRollup merge of #99671 - TaKO8Ki:suggest-dereferencing-index, r=compiler-errors
Yuki Okushi [Fri, 29 Jul 2022 22:39:50 +0000 (07:39 +0900)]
Rollup merge of #99671 - TaKO8Ki:suggest-dereferencing-index, r=compiler-errors

Suggest dereferencing index when trying to use a reference of usize as index

fixes #96678

23 months agoRollup merge of #99518 - dingxiangfei2009:let-else-additional-tests, r=oli-obk
Yuki Okushi [Fri, 29 Jul 2022 22:39:49 +0000 (07:39 +0900)]
Rollup merge of #99518 - dingxiangfei2009:let-else-additional-tests, r=oli-obk

Let-else: break out scopes when a let-else pattern fails to match

This PR will commit to a new behavior so that values from initializer expressions are dropped earlier when a let-else pattern fails to match.

Fix #98672.
Close #93951.
cc `@camsteffen` `@est31`

23 months agoRollup merge of #99227 - Lokathor:fix-thumbv4t-none-eabi-frame-pointer, r=davidtwco
Yuki Okushi [Fri, 29 Jul 2022 22:39:48 +0000 (07:39 +0900)]
Rollup merge of #99227 - Lokathor:fix-thumbv4t-none-eabi-frame-pointer, r=davidtwco

Fix thumbv4t-none-eabi frame pointer setting

The `thumb_base` profile has changed since I last remember seeing it, and now it sets the frame pointer to "always keep", which is not desired for this target. Hooking a debugger to the running program is not really done, it's preferable to have the register available for actual program use, so the default "may omit" is now set.

I thought that the target was already using "may omit" when I checked on it last month, because I forgot that the target was previously based on `thumb_base` rather than `Default::default()`. I only noticed the issue just now when creating the `armv4t-none-eabi` target (https://github.com/rust-lang/rust/pull/99226), though this PR is not in any way conditional on that one.

23 months agoAvoid ICE when fetching LocalDefId
Miguel Guarniz [Wed, 20 Jul 2022 02:51:52 +0000 (22:51 -0400)]
Avoid ICE when fetching LocalDefId

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
23 months agoChange enclosing_body_owner to return LocalDefId
Miguel Guarniz [Tue, 19 Jul 2022 21:47:49 +0000 (17:47 -0400)]
Change enclosing_body_owner to return LocalDefId

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
23 months agoRename local_did to def_id
Miguel Guarniz [Tue, 19 Jul 2022 21:06:52 +0000 (17:06 -0400)]
Rename local_did to def_id

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
23 months agoChange maybe_body_owned_by to take local def id
Miguel Guarniz [Sat, 16 Jul 2022 03:13:04 +0000 (23:13 -0400)]
Change maybe_body_owned_by to take local def id

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
23 months agoAuto merge of #99730 - lcnr:bound-vars-anon, r=jackh726
bors [Fri, 29 Jul 2022 21:38:36 +0000 (21:38 +0000)]
Auto merge of #99730 - lcnr:bound-vars-anon, r=jackh726

anonymize all bound vars, not just regions

fixes #98702

r? types

23 months agoproc_macro: use crossbeam channels for the proc_macro cross-thread bridge
Nika Layzell [Sat, 18 Jun 2022 18:15:03 +0000 (14:15 -0400)]
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.

23 months agoRemove useless closure.
Camille GILLOT [Fri, 29 Jul 2022 20:11:23 +0000 (22:11 +0200)]
Remove useless closure.

23 months agotriagebot.yml: CC Enselic when rustdoc-json-types changes
Martin Nordholts [Fri, 29 Jul 2022 20:04:06 +0000 (22:04 +0200)]
triagebot.yml: CC Enselic when rustdoc-json-types changes

23 months agoAuto merge of #99577 - est31:remove_box_librustdoc, r=jsha
bors [Fri, 29 Jul 2022 18:44:53 +0000 (18:44 +0000)]
Auto merge of #99577 - est31:remove_box_librustdoc, r=jsha

Remove remaining uses of box syntax from librustdoc

Remove the remaining uses of box syntax from librustdoc. Followup of #99066 where these changes were split out because they were responsible for a small but noticeable regression. This PR avoids the regression by boxing some large variants of `ItemKind` to reduce the enum's size by half from 224 bytes to 112 bytes (on x86-64). This should also help with reducing memory usage.

23 months agoStatically ensure the size of ItemKind
est31 [Thu, 21 Jul 2022 21:54:16 +0000 (23:54 +0200)]
Statically ensure the size of ItemKind

23 months agoBox FunctionItem, TyMethodItem, MethodItem, ForeignFunctionItem
est31 [Thu, 21 Jul 2022 22:11:21 +0000 (00:11 +0200)]
Box FunctionItem, TyMethodItem, MethodItem, ForeignFunctionItem

This reduces ItemKind size from 160 bytes to 112 bytes

23 months agoBox TypedefItem, ImplItem, AssocTypeItem variants of ItemKind
est31 [Thu, 21 Jul 2022 21:14:12 +0000 (23:14 +0200)]
Box TypedefItem, ImplItem, AssocTypeItem variants of ItemKind

This reduces ItemKind size from 224 bytes to 160 bytes.

23 months agoRemove box_syntax feature gate from librustdoc
est31 [Sun, 10 Jul 2022 22:29:15 +0000 (00:29 +0200)]
Remove box_syntax feature gate from librustdoc

23 months agoRemove box syntax from doctest.rs
est31 [Thu, 21 Jul 2022 21:00:28 +0000 (23:00 +0200)]
Remove box syntax from doctest.rs

23 months agoRemove box syntax from Box<rustdoc::clean::types::ItemKind> construction
est31 [Sun, 10 Jul 2022 22:08:55 +0000 (00:08 +0200)]
Remove box syntax from Box<rustdoc::clean::types::ItemKind> construction

The type has 240 bytes according to compiler internal rustdoc.

23 months agoUse DefKind instead of FnKind for recursion lint.
Camille GILLOT [Fri, 29 Jul 2022 16:10:43 +0000 (18:10 +0200)]
Use DefKind instead of FnKind for recursion lint.

23 months agoAuto merge of #12906 - cynecx:fix-completions, r=Veykril
bors [Fri, 29 Jul 2022 15:41:36 +0000 (15:41 +0000)]
Auto merge of #12906 - cynecx:fix-completions, r=Veykril

fix: complete path of existing record expr

23 months agoAuto merge of #99467 - BelovDV:add_option_link_arg, r=petrochenkov
bors [Fri, 29 Jul 2022 15:36:52 +0000 (15:36 +0000)]
Auto merge of #99467 - BelovDV:add_option_link_arg, r=petrochenkov

flag '-l link-arg=___ was added

#99427

23 months agofix: complete path of existing record expr
cynecx [Fri, 29 Jul 2022 00:27:16 +0000 (02:27 +0200)]
fix: complete path of existing record expr

23 months agoAdd diagnostic when using public instead of pub
Gimgim [Fri, 29 Jul 2022 13:51:30 +0000 (19:21 +0530)]
Add diagnostic when using public instead of pub

23 months agoAuto merge of #99715 - tmiasko:coverage-run-make, r=Mark-Simulacrum
bors [Fri, 29 Jul 2022 12:45:47 +0000 (12:45 +0000)]
Auto merge of #99715 - tmiasko:coverage-run-make, r=Mark-Simulacrum

Move coverage tests from run-make-fulldeps to run-make