]> git.lizzy.rs Git - rust.git/log
rust.git
2 years 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

2 years 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`

2 years 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`

2 years 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!

2 years 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.

2 years 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`

2 years 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

2 years 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.

2 years 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)`

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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`

2 years 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

2 years 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`

2 years 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`

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

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

2 years 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

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

2 years 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

2 years 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

2 years 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`

2 years 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

2 years 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

2 years 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.

2 years 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

2 years 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`

2 years 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.

2 years 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

2 years 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.

2 years 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

2 years 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.

2 years 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>
2 years 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

2 years 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

2 years 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`

2 years 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

2 years 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

2 years 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`

2 years 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`

2 years 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`

2 years 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

2 years 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

2 years 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.

2 years 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

2 years 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`

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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`

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

2 years 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`

2 years 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

2 years 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.

2 years 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

2 years 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`

2 years 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.

2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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

2 years 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.

2 years 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

2 years 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.

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

2 years 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

2 years 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.

2 years 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

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

2 years 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.

2 years 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

2 years 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

2 years 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

2 years agoRemove unwanted extra white space characters from HTML
Guillaume Gomez [Fri, 29 Jul 2022 12:32:48 +0000 (14:32 +0200)]
Remove unwanted extra white space characters from HTML

2 years agoremove some manual hash stable impls
lcnr [Fri, 29 Jul 2022 10:48:28 +0000 (12:48 +0200)]
remove some manual hash stable impls

2 years agoAuto merge of #99892 - JohnTitor:rollup-qi4fem8, r=JohnTitor
bors [Fri, 29 Jul 2022 09:57:44 +0000 (09:57 +0000)]
Auto merge of #99892 - JohnTitor:rollup-qi4fem8, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #99686 (add suggestion when there is a impl of external trait on pointer with wrong coherence rules)
 - #99760 (doc/rustc: describe the uefi target platforms)
 - #99766 (Htmldocck: Substitute the doc channel when blessing)
 - #99781 (Use String::from_utf8_lossy in CStr demo)
 - #99803 (Update mentions to `rustc_metadata::rmeta::Lazy`)
 - #99845 (Remove `$` prefix for bash scripts in doc)
 - #99850 (rustdoc: Remove more Clean trait implementations)
 - #99872 (Clone the `src/llvm-project` submodule if profiling is enabled)

Failed merges:

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

2 years agoAuto merge of #99667 - ouz-a:some_branch, r=oli-obk
bors [Fri, 29 Jul 2022 07:11:50 +0000 (07:11 +0000)]
Auto merge of #99667 - ouz-a:some_branch, r=oli-obk

Optimize `UnDerefer`

Addresses the performance [issues](https://github.com/rust-lang/rust/pull/98145#issuecomment-1183548597) faced here.

r? `@oli-obk`

2 years agodont call type ascription 'cast'
Michael Goulet [Fri, 29 Jul 2022 07:01:58 +0000 (07:01 +0000)]
dont call type ascription 'cast'

2 years agooptimize bound vars replacement :3
lcnr [Thu, 28 Jul 2022 14:55:15 +0000 (16:55 +0200)]
optimize bound vars replacement :3

2 years agoRollup merge of #99872 - Nilstrieb:bootstrap-llvm, r=jyn514
Yuki Okushi [Fri, 29 Jul 2022 06:40:04 +0000 (15:40 +0900)]
Rollup merge of #99872 - Nilstrieb:bootstrap-llvm, r=jyn514

Clone the `src/llvm-project` submodule if profiling is enabled

To compile rustc with profiling information, `compiler-rt` from LLVM is required. Building it requires the `src/llvm-project` submodule to be initialized and updated.

Fixes #99869

2 years agoRollup merge of #99850 - GuillaumeGomez:clean-more-items, r=notriddle
Yuki Okushi [Fri, 29 Jul 2022 06:40:03 +0000 (15:40 +0900)]
Rollup merge of #99850 - GuillaumeGomez:clean-more-items, r=notriddle

rustdoc: Remove more Clean trait implementations

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

r? `@notriddle`

2 years agoRollup merge of #99845 - xtexChooser:patch-1, r=GuillaumeGomez
Yuki Okushi [Fri, 29 Jul 2022 06:40:02 +0000 (15:40 +0900)]
Rollup merge of #99845 - xtexChooser:patch-1, r=GuillaumeGomez

Remove `$` prefix for bash scripts in doc

2 years agoRollup merge of #99803 - JohnTitor:update-lazy-docs, r=compiler-errors
Yuki Okushi [Fri, 29 Jul 2022 06:40:01 +0000 (15:40 +0900)]
Rollup merge of #99803 - JohnTitor:update-lazy-docs, r=compiler-errors

Update mentions to `rustc_metadata::rmeta::Lazy`

While working on https://github.com/rust-lang/rustc-dev-guide/pull/1411, I noticed there are still some mentions of `Lazy`. This updates them to `LazyValue`, `LazyArray`, or `LazyTable`.

r? ````@compiler-errors````

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2 years agoRollup merge of #99781 - workingjubilee:demo-string-from-cstr, r=thomcc
Yuki Okushi [Fri, 29 Jul 2022 06:40:00 +0000 (15:40 +0900)]
Rollup merge of #99781 - workingjubilee:demo-string-from-cstr, r=thomcc

Use String::from_utf8_lossy in CStr demo

Fixes rust-lang/rust#99755.

2 years agoRollup merge of #99766 - fmease:htmldocck-subst-channel-when-blessing, r=Mark-Simulacrum
Yuki Okushi [Fri, 29 Jul 2022 06:39:59 +0000 (15:39 +0900)]
Rollup merge of #99766 - fmease:htmldocck-subst-channel-when-blessing, r=Mark-Simulacrum

Htmldocck: Substitute the doc channel when blessing

Since #84942, the snippet `{{channel}}` gets substituted with the concrete “doc channel” (e.g. `https://doc.rust-lang.org/nightly`) when snapshot files are checked against the actual rustdoc output.

However, when you `--bless` rustdoc tests, htmldocck just dumps the concrete channel into the snapshot file and
you have to manually do a find-and-replace after blessing to uphold what #84942 set out to fix.

I admit it's a bit fragile to blindly replace URLs like this but I guess it's not too bad in practice.
Feel free to close this PR if you don't think that this is a good idea.

`@rustbot` label T-rustdoc A-testsuite

2 years agoRollup merge of #99760 - dvdhrm:rw/uefiplat, r=ehuss
Yuki Okushi [Fri, 29 Jul 2022 06:39:58 +0000 (15:39 +0900)]
Rollup merge of #99760 - dvdhrm:rw/uefiplat, r=ehuss

doc/rustc: describe the uefi target platforms

Add a `platform-support` entry to the rustc-docs for the different `*-unknown-uefi` targets. This describes in detail how this platform works, a few basic examples, and how to compile for the platform.

Red Hat is sponsoring my work on this platform, so I am putting myself down as target maintainer. Co-maintainers are more than welcome to join me in the effort. Communication is going on off-list to coordinate the different efforts.

Note that the ultimate goal is to move the UEFI targets to Tier-2 so bootloaders can be more easily supported in commercial products. This documentation is the first step towards that goal, but should be a viable documentation even for the current Tier-3 status of the targets.

I also want to point out that there is an ongoing GSoC-effort to port the rust standard library to UEFI (by Ayush Singh). While this work is not necessarily required to get to Tier-2, we definitely should coordinate the efforts and update the documentation as soon as any such ports are merged.

Note that the targets are already used by multiple commercial and non commercial production systems, including, but not limited to:

 * Tianocore-EDK2 (Official UEFI SDK by Intel) comes with rust support
   in its staging repository (not part of any release, yet).
   (https://github.com/tianocore/edk2-staging/tree)
 * Intel's research program "Project Mu" uses the rust UEFI targets to
   show possible future replacements for Tianocore-EDK2.
 * The Rust OS "Redox" uses the UEFI targets for its bootloader.
   (https://www.redox-os.org/)
 * The hugely popular in-depth documentation of OS development in Rust
   by Philipp Oppermann uses the UEFI targets.
   (https://os.phil-opp.com/)

2 years agoRollup merge of #99686 - vincenzopalazzo:macros/impl_on_ptr, r=compiler-errors
Yuki Okushi [Fri, 29 Jul 2022 06:39:57 +0000 (15:39 +0900)]
Rollup merge of #99686 - vincenzopalazzo:macros/impl_on_ptr, r=compiler-errors

add suggestion when there is a impl of external trait on pointer with wrong coherence rules

Closes https://github.com/rust-lang/rust/issues/99572

This will try to improve the node in the error message by suggesting a general solution because the solution, in this case, is application depended.

I'm not super happy regarding the code quality, but I'm happy to have feedback on it.

`@rustbot` r? `@compiler-errors`

2 years agoDocument check_region_obligations_and_report_errors, simplify a call to resolve_regions
Michael Goulet [Fri, 29 Jul 2022 06:17:17 +0000 (06:17 +0000)]
Document check_region_obligations_and_report_errors, simplify a call to resolve_regions