]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoMake non-ASCII errors more consistent.
Nicholas Nethercote [Thu, 3 Nov 2022 04:17:37 +0000 (15:17 +1100)]
Make non-ASCII errors more consistent.

There are three kinds of "byte" literals: byte literals, byte string
literals, and raw byte string literals. None are allowed to have
non-ASCII chars in them.

Two `EscapeError` variants exist for when that constraint is violated.
- `NonAsciiCharInByte`: used for byte literals and byte string literals.
- `NonAsciiCharInByteString`: used for raw byte string literals.

As a result, the messages for raw byte string literals use different
wording, without good reason. Also, byte string literals are incorrectly
described as "byte constants" in some error messages.

This commit eliminates `NonAsciiCharInByteString` so the three cases are
handled similarly, and described correctly. The `mode` is enough to
distinguish them.

Note: Some existing error messages mention "byte constants" and some
mention "byte literals". I went with the latter here, because it's a
more correct name, as used by the Reference.

19 months agoUse `Mode` less.
Nicholas Nethercote [Thu, 3 Nov 2022 02:35:49 +0000 (13:35 +1100)]
Use `Mode` less.

It's passed to numerous places where we just need an `is_byte` bool.
Passing the bool avoids the need for some assertions.

Also rename `is_bytes()` as `is_byte()`, to better match `Mode::Byte`,
`Mode::ByteStr`, and `Mode::RawByteStr`.

19 months agoClarify range calculations.
Nicholas Nethercote [Thu, 3 Nov 2022 01:15:55 +0000 (12:15 +1100)]
Clarify range calculations.

There is some subtlety here.

19 months agoRename some variables.
Nicholas Nethercote [Thu, 3 Nov 2022 00:31:07 +0000 (11:31 +1100)]
Rename some variables.

These have been bugging me for a while.

- `literal_text`: `src` is also used and is shorter and better.
- `first_char`: used even when "first" doesn't make sense; `c` is
  shorter and better.
- `curr`: `c` is shorter and better.
- `unescaped_char`: `result` is also used and is shorter and better.
- `second_char`: these have a single use and can be elided.

19 months agoAuto merge of #103331 - nnethercote:convert-switch-to-br, r=scottmcm
bors [Mon, 31 Oct 2022 00:40:32 +0000 (00:40 +0000)]
Auto merge of #103331 - nnethercote:convert-switch-to-br, r=scottmcm

Use `br` instead of `switch` in more cases.

`codegen_switchint_terminator` already uses `br` instead of `switch` when there is one normal target plus the `otherwise` target. But there's another common case with two normal targets and an `otherwise` target that points to an empty unreachable BB. This comes up a lot when switching on the tags of enums that use niches.

The pattern looks like this:
```
bb1:                                              ; preds = %bb6
  %3 = load i8, ptr %_2, align 1, !range !9, !noundef !4
  %4 = sub i8 %3, 2
  %5 = icmp eq i8 %4, 0
  %_6 = select i1 %5, i64 0, i64 1
  switch i64 %_6, label %bb3 [
    i64 0, label %bb4
    i64 1, label %bb2
  ]

bb3:                                              ; preds = %bb1
  unreachable
```
This commit adds code to convert the `switch` to a `br`:
```
bb1:                                              ; preds = %bb6
  %3 = load i8, ptr %_2, align 1, !range !9, !noundef !4
  %4 = sub i8 %3, 2
  %5 = icmp eq i8 %4, 0
  %_6 = select i1 %5, i64 0, i64 1
  %6 = icmp eq i64 %_6, 0
  br i1 %6, label %bb4, label %bb2

bb3:                                              ; No predecessors!
  unreachable
```
This has a surprisingly large effect on compile times, with reductions of 5% on debug builds of some crates. The reduction is all due to LLVM taking less time. Maybe LLVM is just much better at handling `br` than `switch`.

The resulting code is still suboptimal.
- The `icmp`, `select`, `icmp` sequence is silly, converting an `i1` to an `i64` and back to an `i1`. But with the current code structure it's hard to avoid, and LLVM will easily clean it up, in opt builds at least.
- `bb3` is usually now truly dead code (though not always, so it can't be removed universally).

r? `@scottmcm`

19 months agoUse `br` instead of `switch` in more cases.
Nicholas Nethercote [Thu, 20 Oct 2022 07:59:07 +0000 (18:59 +1100)]
Use `br` instead of `switch` in more cases.

`codegen_switchint_terminator` already uses `br` instead of `switch`
when there is one normal target plus the `otherwise` target. But there's
another common case with two normal targets and an `otherwise` target
that points to an empty unreachable BB. This comes up a lot when
switching on the tags of enums that use niches.

The pattern looks like this:
```
bb1:                                              ; preds = %bb6
  %3 = load i8, ptr %_2, align 1, !range !9, !noundef !4
  %4 = sub i8 %3, 2
  %5 = icmp eq i8 %4, 0
  %_6 = select i1 %5, i64 0, i64 1
  switch i64 %_6, label %bb3 [
    i64 0, label %bb4
    i64 1, label %bb2
  ]

bb3:                                              ; preds = %bb1
  unreachable
```
This commit adds code to convert the `switch` to a `br`:
```
bb1:                                              ; preds = %bb6
  %3 = load i8, ptr %_2, align 1, !range !9, !noundef !4
  %4 = sub i8 %3, 2
  %5 = icmp eq i8 %4, 0
  %_6 = select i1 %5, i64 0, i64 1
  %6 = icmp eq i64 %_6, 0
  br i1 %6, label %bb4, label %bb2

bb3:                                              ; No predecessors!
  unreachable
```
This has a surprisingly large effect on compile times, with reductions
of 5% on debug builds of some crates. The reduction is all due to LLVM
taking less time. Maybe LLVM is just much better at handling `br` than
`switch`.

The resulting code is still suboptimal.
- The `icmp`, `select`, `icmp` sequence is silly, converting an `i1` to an `i64`
  and back to an `i1`. But with the current code structure it's hard to avoid,
  and LLVM will easily clean it up, in opt builds at least.
- `bb3` is usually now truly dead code (though not always, so it can't
  be removed universally).

19 months agoAuto merge of #103479 - nikic:update-llvm-9, r=cuviper
bors [Sun, 30 Oct 2022 20:31:48 +0000 (20:31 +0000)]
Auto merge of #103479 - nikic:update-llvm-9, r=cuviper

Update LLVM submodule

Merge upstream `release/15.x` branch.

Fixes #102738.

19 months agoAuto merge of #103299 - nikic:usub-overflow, r=wesleywiser
bors [Sun, 30 Oct 2022 17:45:04 +0000 (17:45 +0000)]
Auto merge of #103299 - nikic:usub-overflow, r=wesleywiser

Don't use usub.with.overflow intrinsic

The canonical form of a usub.with.overflow check in LLVM are separate sub + icmp instructions, rather than a usub.with.overflow intrinsic. Using usub.with.overflow will generally result in worse optimization potential.

The backend will attempt to form usub.with.overflow when it comes to actual instruction selection. This is not fully reliable, but I believe this is a better tradeoff than using the intrinsic in IR.

Fixes #103285.

19 months agoAuto merge of #103295 - ishitatsuyuki:ninja, r=cuviper
bors [Sun, 30 Oct 2022 14:13:42 +0000 (14:13 +0000)]
Auto merge of #103295 - ishitatsuyuki:ninja, r=cuviper

ci: Bring back ninja for dist builders

The primary reason for this is that make can result in a substantial under utilization of parallelism (noticed while testing on a workstation), mostly due to the submake structure preventing good dependency tracking and scheduling.

In f758c7b2a78 (Debian 6 doesn't have ninja, so use make for the dist builds) llvm.ninja was disabled due to lack of distro package. This is no longer the case with the CentOS 7 base, so bring ninja back for a performance boost.

19 months agoAuto merge of #103010 - petrochenkov:effvisdoc, r=GuillaumeGomez
bors [Sun, 30 Oct 2022 10:52:04 +0000 (10:52 +0000)]
Auto merge of #103010 - petrochenkov:effvisdoc, r=GuillaumeGomez

rustdoc: Simplify modifications of effective visibility table

It is now obvious that rustdoc only calls `set_access_level` with foreign def ids and `AccessLevel::Public`.

The second commit makes one more step and separates effective visibilities coming from rustc from similar data collected by rustdoc for extern `DefId`s.
The original table is no longer modified and now only contains local def ids as populated by rustc.

cc https://github.com/rust-lang/rust/pull/102026 `@Bryanskiy`

19 months agoAuto merge of #103755 - Dylan-DPC:rollup-dl2hups, r=Dylan-DPC
bors [Sun, 30 Oct 2022 08:09:59 +0000 (08:09 +0000)]
Auto merge of #103755 - Dylan-DPC:rollup-dl2hups, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #93582 (Allow `impl Fn() -> impl Trait` in return position)
 - #103560 (Point only to the identifiers in the typo suggestions of shadowed names instead of the entire struct)
 - #103588 (rustdoc: add missing URL redirect)
 - #103689 (Do fewer passes and generally be more efficient when filtering tests)
 - #103740 (rustdoc: remove unnecessary CSS `.search-results { padding-bottom }`)

Failed merges:

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

19 months agoRollup merge of #103740 - notriddle:notriddle/search-results-padding-bottom, r=Dylan-DPC
Dylan DPC [Sun, 30 Oct 2022 06:20:28 +0000 (11:50 +0530)]
Rollup merge of #103740 - notriddle:notriddle/search-results-padding-bottom, r=Dylan-DPC

rustdoc: remove unnecessary CSS `.search-results { padding-bottom }`

There's nothing underneath it anyway. The conversation on #84462 never really spelled out why it was added.

19 months agoRollup merge of #103689 - saethlin:libtest-startup, r=thomcc
Dylan DPC [Sun, 30 Oct 2022 06:20:27 +0000 (11:50 +0530)]
Rollup merge of #103689 - saethlin:libtest-startup, r=thomcc

Do fewer passes and generally be more efficient when filtering tests

Follow-on of the work I started with this PR: https://github.com/rust-lang/rust/pull/99939

Basically, the startup code for libtest is really inefficient, but that's not usually a problem because it is distributed in release and workloads are small. But under Miri which can be 100x slower than a debug build, these inefficiencies explode.

Most of the diff here is making test filtering single-pass. There are a few other small optimizations as well, but they are more straightforward.

With this PR, the startup time of the `iced` tests with `--features=code_asm,mvex` drops from 17 to 2 minutes (I think Miri has gotten slower under this workload since #99939). The easiest way to try this out is to set `MIRI_LIB_SRC` to a checkout of this branch when running `cargo +nightly miri test --features=code_asm,mvex`.

r? `@thomcc`

19 months agoRollup merge of #103588 - weihanglo:rustdoc/url-redirect, r=notriddle
Dylan DPC [Sun, 30 Oct 2022 06:20:27 +0000 (11:50 +0530)]
Rollup merge of #103588 - weihanglo:rustdoc/url-redirect, r=notriddle

rustdoc: add missing URL redirect

https://github.com/rust-lang/rust/pull/94753 missed some redirect settings, and one of the missing URL shows up in an error message. This PR adds those redirects.

19 months agoRollup merge of #103560 - zbyrn:issue-103358-fix, r=cjgillot
Dylan DPC [Sun, 30 Oct 2022 06:20:26 +0000 (11:50 +0530)]
Rollup merge of #103560 - zbyrn:issue-103358-fix, r=cjgillot

Point only to the identifiers in the typo suggestions of shadowed names instead of the entire struct

Fixes #103358.

As discussed in the issue, the `Span` of the candidate `Ident` for a typo replacement is stored alongside its `Symbol` in `TypoSuggestion`. Then, the span of the identifier is what the "you might have meant to refer to" note is pointed at, rather than the entire struct definition.

Comments in #103111 and the issue both suggest that it is desirable to:
1. include names defined in the same crate as the typo,
2. ignore names defined elsewhere such as in `std`, _and_
3. include names introduced indirectly via `use`.

Since a name from another crate but introduced via `use` has non-local `def_id`, to achieve this, a suggestion is displayed if either the `def_id` of the suggested name is local, or the `span` of the suggested name is in the same file as the typo itself.

Some UI tests have also been modified to reflect this change.

r? `@cjgillot`

19 months agoRollup merge of #93582 - WaffleLapkin:rpitirpit, r=compiler-errors
Dylan DPC [Sun, 30 Oct 2022 06:20:26 +0000 (11:50 +0530)]
Rollup merge of #93582 - WaffleLapkin:rpitirpit, r=compiler-errors

Allow `impl Fn() -> impl Trait` in return position

_This was originally proposed as part of #93082 which was [closed](https://github.com/rust-lang/rust/pull/93082#issuecomment-1027225715) due to allowing `impl Fn() -> impl Trait` in argument position._

This allows writing the following function signatures:
```rust
fn f0() -> impl Fn() -> impl Trait;
fn f3() -> &'static dyn Fn() -> impl Trait;
```

These signatures were already allowed for common traits and associated types, there is no reason why `Fn*` traits should be special in this regard.

`impl Trait` in both `f0` and `f3` means "new existential type", just like with `-> impl Iterator<Item = impl Trait>` and such.

Arrow in `impl Fn() ->` is right-associative and binds from right to left, it's tested by [this test](https://github.com/WaffleLapkin/rust/blob/a819fecb8dea438fc70488ddec30a61e52942672/src/test/ui/impl-trait/impl_fn_associativity.rs).

There even is a test that `f0` compiles:
https://github.com/rust-lang/rust/blob/2f004d2d401682e553af3984ebd9a3976885e752/src/test/ui/impl-trait/nested_impl_trait.rs#L25-L28

But it was changed in [PR 48084 (lines)](https://github.com/rust-lang/rust/pull/48084/files#diff-ccecca938872d65ffe8cd1c3ef1956e309fac83bcda547d8b16b89257e53a437R37)  to test the opposite, probably unintentionally given [PR 48084 (lines)](https://github.com/rust-lang/rust/pull/48084/files#diff-5a02f1ed43debed1fd24f7aad72490064f795b9420f15d847bac822aa4621a1cR476-R477).

r? `@nikomatsakis`

----

This limitation is especially annoying with async code, since it forces one to write this:
```rust
trait AsyncFn3<A, B, C>: Fn(A, B, C) -> <Self as AsyncFn3<A, B, C>>::Future {
    type Future: Future<Output = Self::Out>;

    type Out;
}

impl<A, B, C, Fut, F> AsyncFn3<A, B, C> for F
where
    F: Fn(A, B, C) -> Fut,
    Fut: Future,
{
    type Future = Fut;

    type Out = Fut::Output;
}

fn async_closure() -> impl AsyncFn3<i32, i32, i32, Out = u32> {
    |a, b, c| async move { (a + b + c) as u32 }
}
```
Instead of:
```rust
fn async_closure() -> impl Fn(i32, i32, i32) -> impl Future<Output = u32> {
    |a, b, c| async move { (a + b + c) as u32 }
}
```

19 months agoAuto merge of #103721 - RalfJung:miri, r=RalfJung
bors [Sun, 30 Oct 2022 05:22:37 +0000 (05:22 +0000)]
Auto merge of #103721 - RalfJung:miri, r=RalfJung

update Miri

Noteworthy PRs:
- https://github.com/rust-lang/miri/pull/2624
- https://github.com/rust-lang/miri/pull/2626
- https://github.com/rust-lang/miri/pull/2630
- https://github.com/rust-lang/miri/pull/2631

19 months agoAuto merge of #103745 - matthiaskrgr:rollup-hipjva8, r=matthiaskrgr
bors [Sun, 30 Oct 2022 02:26:41 +0000 (02:26 +0000)]
Auto merge of #103745 - matthiaskrgr:rollup-hipjva8, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #100006 (Make `core::mem::copy` const)
 - #102659 (1.65.0 release notes)
 - #103124 (Add tests for autoderef on block tail)
 - #103253 (rustdoc: add test case for masked blanket impl)
 - #103715 (use consistent terminology)
 - #103722 (Fix z-indexes of code example feature and cleanup its CSS)
 - #103726 (Avoid unnecessary `&str` to `String` conversions)
 - #103737 (rustdoc: use CSS margin/padding shorthand when all are being set)

Failed merges:

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

19 months agoAuto merge of #103731 - Mark-Simulacrum:new-version, r=Mark-Simulacrum
bors [Sat, 29 Oct 2022 23:25:13 +0000 (23:25 +0000)]
Auto merge of #103731 - Mark-Simulacrum:new-version, r=Mark-Simulacrum

Bump to 1.67.0

r? `@Mark-Simulacrum`

19 months agoRollup merge of #103737 - notriddle:notriddle/margin, r=GuillaumeGomez
Matthias Krüger [Sat, 29 Oct 2022 22:09:27 +0000 (00:09 +0200)]
Rollup merge of #103737 - notriddle:notriddle/margin, r=GuillaumeGomez

rustdoc: use CSS margin/padding shorthand when all are being set

19 months agoRollup merge of #103726 - TaKO8Ki:avoid-&str-to-string-conversions, r=compiler-errors
Matthias Krüger [Sat, 29 Oct 2022 22:09:26 +0000 (00:09 +0200)]
Rollup merge of #103726 - TaKO8Ki:avoid-&str-to-string-conversions, r=compiler-errors

Avoid unnecessary `&str` to `String` conversions

19 months agoRollup merge of #103722 - GuillaumeGomez:cleanup-code-example-css, r=notriddle
Matthias Krüger [Sat, 29 Oct 2022 22:09:26 +0000 (00:09 +0200)]
Rollup merge of #103722 - GuillaumeGomez:cleanup-code-example-css, r=notriddle

Fix z-indexes of code example feature and cleanup its CSS

When reviewing https://github.com/rust-lang/rust/pull/103650, I realized that the `z-index`es of this feature were completely broken:

![Screenshot from 2022-10-28 10-55-27](https://user-images.githubusercontent.com/3050060/198826360-0c5cbe5a-ea8e-452a-9504-38d3da3615e6.png)

This PR fixes it by reducing the value of value under the one used for `.popover` (it could be completely removed but then it wouldn't be displayed as nicely).

There was also a lot of duplicated CSS so I merged the rules.

r? `@notriddle`

19 months agoRollup merge of #103715 - tshepang:consistency, r=Dylan-DPC
Matthias Krüger [Sat, 29 Oct 2022 22:09:25 +0000 (00:09 +0200)]
Rollup merge of #103715 - tshepang:consistency, r=Dylan-DPC

use consistent terminology

I did not see other traits using the "interface" word

19 months agoRollup merge of #103253 - notriddle:notriddle/test-case-masked-blanket-impl, r=Mark...
Matthias Krüger [Sat, 29 Oct 2022 22:09:25 +0000 (00:09 +0200)]
Rollup merge of #103253 - notriddle:notriddle/test-case-masked-blanket-impl, r=Mark-Simulacrum

rustdoc: add test case for masked blanket impl

19 months agoRollup merge of #103124 - ldm0:nohard_tests, r=Mark-Simulacrum
Matthias Krüger [Sat, 29 Oct 2022 22:09:24 +0000 (00:09 +0200)]
Rollup merge of #103124 - ldm0:nohard_tests, r=Mark-Simulacrum

Add tests for autoderef on block tail

ref: https://github.com/rust-lang/rust/pull/83850#issuecomment-1270598506

19 months agoRollup merge of #102659 - Mark-Simulacrum:relnotes, r=Mark-Simulacrum
Matthias Krüger [Sat, 29 Oct 2022 22:09:24 +0000 (00:09 +0200)]
Rollup merge of #102659 - Mark-Simulacrum:relnotes, r=Mark-Simulacrum

1.65.0 release notes

r? `@cuviper` (since you're writing the blog)

19 months agoRollup merge of #100006 - jyn514:update-copy, r=dtolnay
Matthias Krüger [Sat, 29 Oct 2022 22:09:23 +0000 (00:09 +0200)]
Rollup merge of #100006 - jyn514:update-copy, r=dtolnay

Make `core::mem::copy` const

cc https://github.com/rust-lang/rust/issues/98262, https://github.com/rust-lang/libs-team/issues/78

19 months agorustc_middle: Remove unnecessary type parameter from `AccessLevels`
Vadim Petrochenkov [Sat, 29 Oct 2022 10:58:37 +0000 (14:58 +0400)]
rustc_middle: Remove unnecessary type parameter from `AccessLevels`

19 months agorustdoc: Split effective visibilities from rustc from similar data built by rustdoc...
Vadim Petrochenkov [Wed, 19 Oct 2022 18:37:59 +0000 (22:37 +0400)]
rustdoc: Split effective visibilities from rustc from similar data built by rustdoc for external def-ids

19 months agorustdoc: Simplify modifications of effective visibility table
Vadim Petrochenkov [Thu, 13 Oct 2022 12:53:48 +0000 (16:53 +0400)]
rustdoc: Simplify modifications of effective visibility table

19 months ago1.65.0 release notes
Mark Rousskov [Tue, 4 Oct 2022 13:51:01 +0000 (09:51 -0400)]
1.65.0 release notes

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
Co-authored-by: Christopher Serr <christopher.serr@gmail.com>
Co-authored-by: memoryruins <michael@memoryruins.com>
Co-authored-by: Alexander Ronald Altman <alexanderaltman@me.com>
19 months agoDrop miri cross-compile check for Windows
Mark Rousskov [Sat, 29 Oct 2022 18:24:44 +0000 (14:24 -0400)]
Drop miri cross-compile check for Windows

19 months agoAuto merge of #103450 - cjgillot:elision-nodedup, r=Mark-Simulacrum
bors [Sat, 29 Oct 2022 17:32:45 +0000 (17:32 +0000)]
Auto merge of #103450 - cjgillot:elision-nodedup, r=Mark-Simulacrum

Do not consider repeated lifetime params for elision.

Fixes https://github.com/rust-lang/rust/issues/103330

19 months agorustdoc: remove unnecessary `.search-results { padding-bottom }`
Michael Howell [Sat, 29 Oct 2022 16:59:53 +0000 (09:59 -0700)]
rustdoc: remove unnecessary `.search-results { padding-bottom }`

There's nothing underneath it anyway. The conversation on
b615c0c85469c94041a5e68b9d8b68dcf799f9f1 never really spelled out why it
was added.

19 months agorustdoc: use CSS margin/padding shorthand when all are being set
Michael Howell [Sat, 29 Oct 2022 16:04:31 +0000 (09:04 -0700)]
rustdoc: use CSS margin/padding shorthand when all are being set

19 months agoBump to 1.67.0
Mark Rousskov [Sat, 29 Oct 2022 14:28:52 +0000 (10:28 -0400)]
Bump to 1.67.0

19 months agoAuto merge of #103727 - GuillaumeGomez:rollup-hfyxccr, r=GuillaumeGomez
bors [Sat, 29 Oct 2022 14:14:08 +0000 (14:14 +0000)]
Auto merge of #103727 - GuillaumeGomez:rollup-hfyxccr, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #102634 (compiletest: Refactor test rustcflags)
 - #102721 (Prevent foreign Rust exceptions from being caught)
 - #103415 (filter candidates in pick probe for diagnostics)
 - #103618 (Rename some `OwnerId` fields.)
 - #103625 (Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functions)
 - #103653 (Add missing impl blocks for item reexported from private mod in JSON output)
 - #103699 (Emit proper error when casting to `dyn*`)
 - #103719 (fix typo in `try_reserve` method from `HashMap` and `HashSet`)

Failed merges:

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

19 months agoRollup merge of #103719 - joseluis:fix-typos-try-reserve, r=the8472
Guillaume Gomez [Sat, 29 Oct 2022 12:18:05 +0000 (14:18 +0200)]
Rollup merge of #103719 - joseluis:fix-typos-try-reserve, r=the8472

fix typo in `try_reserve` method from `HashMap` and `HashSet`

Currently refers to the `reserve` method, instead of `try_reserve`. Other collections like [Vec](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.try_reserve) & [VecDeque](https://doc.rust-lang.org/std/collections/vec_deque/struct.VecDeque.html#method.try_reserve) shows it well.

19 months agoRollup merge of #103699 - compiler-errors:dyn-star-cast-bad, r=TaKO8Ki
Guillaume Gomez [Sat, 29 Oct 2022 12:18:05 +0000 (14:18 +0200)]
Rollup merge of #103699 - compiler-errors:dyn-star-cast-bad, r=TaKO8Ki

Emit proper error when casting to `dyn*`

Fixes #103679

19 months agoRollup merge of #103653 - GuillaumeGomez:missing-impl-private-json, r=notriddle
Guillaume Gomez [Sat, 29 Oct 2022 12:18:04 +0000 (14:18 +0200)]
Rollup merge of #103653 - GuillaumeGomez:missing-impl-private-json, r=notriddle

Add missing impl blocks for item reexported from private mod in JSON output

Fixes #102583.

Since we don't inline for the JSON output, the impl blocks from private modules are not present when we generate the output. To go around this limitation, in case the impl block doesn't have `#[doc(hidden)]` and is implementing a public item, we don't strip it.

cc `@fmease` `@aDotInTheVoid`
r? `@notriddle`

19 months agoRollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=compiler-errors
Guillaume Gomez [Sat, 29 Oct 2022 12:18:03 +0000 (14:18 +0200)]
Rollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=compiler-errors

Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functions

Functions in answer:

- `Ty::is_freeze`
- `Ty::is_sized`
- `Ty::is_unpin`
- `Ty::is_copy_modulo_regions`

This allows to remove a lot of useless `.at(DUMMY_SP)`, making the code a bit nicer :3

r? `@compiler-errors`

19 months agoRollup merge of #103618 - nnethercote:rename-OwnerId-fields, r=compiler-errors
Guillaume Gomez [Sat, 29 Oct 2022 12:18:03 +0000 (14:18 +0200)]
Rollup merge of #103618 - nnethercote:rename-OwnerId-fields, r=compiler-errors

Rename some `OwnerId` fields.

`@spastorino` noticed some silly expressions like `item_id.def_id.def_id`.

This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`.

`item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.

r? `@compiler-errors`

19 months agoRollup merge of #103415 - compiler-errors:tiny-perf-increase-on-diagnostic, r=TaKO8Ki
Guillaume Gomez [Sat, 29 Oct 2022 12:18:02 +0000 (14:18 +0200)]
Rollup merge of #103415 - compiler-errors:tiny-perf-increase-on-diagnostic, r=TaKO8Ki

filter candidates in pick probe for diagnostics

Fixes #103411, though also fine with closing this PR if my opinion (https://github.com/rust-lang/rust/issues/103411#issuecomment-1287900069) is shared that this doesn't need to  be fixed.

```
~/rust3$ time rustc +nightly ~/test.rs 2>/dev/null

real    0m4.853s
user    0m4.837s
sys     0m0.016s

~/rust3$ time rustc +rust3 ~/test.rs 2>/dev/null

real    0m0.193s
user    0m0.169s
sys     0m0.024s
```

Also fixes #103427.

19 months agoRollup merge of #102721 - nbdd0121:panic, r=Amanieu
Guillaume Gomez [Sat, 29 Oct 2022 12:18:02 +0000 (14:18 +0200)]
Rollup merge of #102721 - nbdd0121:panic, r=Amanieu

Prevent foreign Rust exceptions from being caught

Fix #102715

Use the address of a static variable (which is guaranteed to be unique per copy of std) to tell apart if a Rust exception comes from local or foreign Rust code, and abort for the latter.

19 months agoRollup merge of #102634 - andrewpollack:refactor-test-rustcflags, r=Mark-Simulacrum
Guillaume Gomez [Sat, 29 Oct 2022 12:18:01 +0000 (14:18 +0200)]
Rollup merge of #102634 - andrewpollack:refactor-test-rustcflags, r=Mark-Simulacrum

compiletest: Refactor test rustcflags

Refactoring `host-rustcflags` and `target-rustcflags` from `Option<String>` to `Vec<String>`

Ref: #102438

r? `@Mark-Simulacrum`

19 months agoFix z-indexes of code example feature and cleanup its CSS
Guillaume Gomez [Sat, 29 Oct 2022 10:23:10 +0000 (12:23 +0200)]
Fix z-indexes of code example feature and cleanup its CSS

19 months agoAdd regression test for missing item from private mod in JSON output
Guillaume Gomez [Thu, 27 Oct 2022 19:48:54 +0000 (21:48 +0200)]
Add regression test for missing item from private mod in JSON output

19 months agoAdd missing impl blocks for item reexported from private mod in JSON output
Guillaume Gomez [Thu, 27 Oct 2022 19:48:34 +0000 (21:48 +0200)]
Add missing impl blocks for item reexported from private mod in JSON output

19 months agoRename some `OwnerId` fields.
Nicholas Nethercote [Thu, 27 Oct 2022 03:02:18 +0000 (14:02 +1100)]
Rename some `OwnerId` fields.

spastorino noticed some silly expressions like `item_id.def_id.def_id`.

This commit renames several `def_id: OwnerId` fields as `owner_id`, so
those expressions become `item_id.owner_id.def_id`.

`item_id.owner_id.local_def_id` would be even clearer, but the use of
`def_id` for values of type `LocalDefId` is *very* widespread, so I left
that alone.

19 months agoAuto merge of #103714 - matthiaskrgr:rollup-kajt3i8, r=matthiaskrgr
bors [Sat, 29 Oct 2022 09:21:35 +0000 (09:21 +0000)]
Auto merge of #103714 - matthiaskrgr:rollup-kajt3i8, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #102961 (Make `CStr::from_ptr` `const`.)
 - #103342 (Add test for issue 98634)
 - #103383 (Note scope of TAIT more accurately)
 - #103656 (Specialize ToString for Symbol)
 - #103663 (rustdoc: remove redundant CSS/DOM `div.search-container`)
 - #103664 (rustdoc-json-types: Improve ItemSummary::path docs)
 - #103704 (Add a test for TAIT used with impl/dyn Trait inside RPIT)

Failed merges:

 - #103618 (Rename some `OwnerId` fields.)

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

19 months agofix typo in hashmap and hashset try_reserve method
joseLuís [Sat, 29 Oct 2022 08:49:53 +0000 (10:49 +0200)]
fix typo in hashmap and hashset try_reserve method

19 months agoAuto merge of #2631 - RalfJung:futex-wait-no-isolate, r=RalfJung
bors [Sat, 29 Oct 2022 09:00:14 +0000 (09:00 +0000)]
Auto merge of #2631 - RalfJung:futex-wait-no-isolate, r=RalfJung

Support timeouts with monotonic clocks even when isolation is enabled

With the deterministic monotonic clock support we now have, we can allow some synchronization primitives with timeouts even under isolation:
- Linux futex waiting (when set to the monotonic clock)
- pthread_cond_timedwait (when set to the monotonic clock)
- Windows WaitOnAddress

Unfortunately none of these exist on macOS -- the standard library always uses the system clock for timeouts on macOS, so that will still require `-Zmiri-disable-isolation`.

19 months agoavoid unnecessary `&str` to `String` conversions
Takayuki Maeda [Sat, 29 Oct 2022 08:14:44 +0000 (17:14 +0900)]
avoid unnecessary `&str` to `String` conversions

19 months agouse consistent terminology
Tshepang Mbambo [Sat, 29 Oct 2022 07:23:12 +0000 (09:23 +0200)]
use consistent terminology

I did not see other traits using the "interface" word

19 months agoRollup merge of #103704 - xxchan:xxchan/applicable-bug, r=compiler-errors
Matthias Krüger [Sat, 29 Oct 2022 06:57:37 +0000 (08:57 +0200)]
Rollup merge of #103704 - xxchan:xxchan/applicable-bug, r=compiler-errors

Add a test for TAIT used with impl/dyn Trait inside RPIT

close https://github.com/rust-lang/rust/issues/101750

19 months agoRollup merge of #103664 - aDotInTheVoid:rdj-path-docs, r=Urgau,GuillaumeGomez
Matthias Krüger [Sat, 29 Oct 2022 06:57:37 +0000 (08:57 +0200)]
Rollup merge of #103664 - aDotInTheVoid:rdj-path-docs, r=Urgau,GuillaumeGomez

rustdoc-json-types: Improve ItemSummary::path docs

Somewhat inspired by the doc changes from #103085 (cc ``@Urgau)``

r? ``@GuillaumeGomez``

19 months agoRollup merge of #103663 - notriddle:notriddle/search-container, r=GuillaumeGomez
Matthias Krüger [Sat, 29 Oct 2022 06:57:36 +0000 (08:57 +0200)]
Rollup merge of #103663 - notriddle:notriddle/search-container, r=GuillaumeGomez

rustdoc: remove redundant CSS/DOM `div.search-container`

Preview: https://notriddle.com/notriddle-rustdoc-demos/search-container/test_dingus/fn.test.html

This wrapper DIV was originally added in 89e1fb322321c05497caa01372ceb7d5b57fa680, when it allowed the search bar's size to be calculated without using `calc()`. This `width` hack can be        removed using flexbox.

19 months agoRollup merge of #103656 - camsteffen:symbol-to-string, r=compiler-errors
Matthias Krüger [Sat, 29 Oct 2022 06:57:36 +0000 (08:57 +0200)]
Rollup merge of #103656 - camsteffen:symbol-to-string, r=compiler-errors

Specialize ToString for Symbol

19 months agoRollup merge of #103383 - compiler-errors:tait-scope, r=oli-obk
Matthias Krüger [Sat, 29 Oct 2022 06:57:35 +0000 (08:57 +0200)]
Rollup merge of #103383 - compiler-errors:tait-scope, r=oli-obk

Note scope of TAIT more accurately

This maybe explains why the person was confused in #101897, since we say "same module" but really should've said "same impl".

r? ``@oli-obk``

19 months agoRollup merge of #103342 - Rageking8:add-test-for-issue-98634, r=compiler-errors
Matthias Krüger [Sat, 29 Oct 2022 06:57:35 +0000 (08:57 +0200)]
Rollup merge of #103342 - Rageking8:add-test-for-issue-98634, r=compiler-errors

Add test for issue 98634

Fixes #98634

19 months agoRollup merge of #102961 - reitermarkus:const-cstr-from-ptr, r=oli-obk
Matthias Krüger [Sat, 29 Oct 2022 06:57:34 +0000 (08:57 +0200)]
Rollup merge of #102961 - reitermarkus:const-cstr-from-ptr, r=oli-obk

Make `CStr::from_ptr` `const`.

Should be included in https://github.com/rust-lang/rust/issues/101719.

cc ``@WaffleLapkin``

19 months agoAuto merge of #102698 - michaelwoerister:unord-collections, r=lncr
bors [Sat, 29 Oct 2022 06:20:48 +0000 (06:20 +0000)]
Auto merge of #102698 - michaelwoerister:unord-collections, r=lncr

Introduce UnordMap, UnordSet, and UnordBag (MCP 533)

This is the start of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).

I followed `@eddyb's` suggestion of naming the collection types `Unord(Map/Set/Bag)` which is a bit easier to type than `Unordered(Map/Set/Bag)`

r? `@eddyb`

19 months agoAuto merge of #102233 - petrochenkov:effvis, r=jackh726
bors [Sat, 29 Oct 2022 03:08:59 +0000 (03:08 +0000)]
Auto merge of #102233 - petrochenkov:effvis, r=jackh726

privacy: Rename "accessibility levels" to "effective visibilities"

And a couple of other naming and comment tweaks.

Related to https://github.com/rust-lang/rust/issues/48054

For `enum Level` I initially used naming `enum EffectiveVisibilityLevel`, but it was too long and inconvenient because it's used pretty often.
So I shortened it to just `Level`, if it needs to be used from some context where this name would be ambiguous, then it can be imported with renaming like `use rustc_middle::privacy::Level as EffVisLevel` or something.

19 months agoAuto merge of #102737 - RalfJung:poll_fn_pin, r=Mark-Simulacrum
bors [Fri, 28 Oct 2022 23:27:33 +0000 (23:27 +0000)]
Auto merge of #102737 - RalfJung:poll_fn_pin, r=Mark-Simulacrum

poll_fn and Unpin: fix pinning

See [IRLO](https://internals.rust-lang.org/t/surprising-soundness-trouble-around-pollfn/17484) for details: currently `poll_fn` is very subtle to use, since it does not pin the closure, so creating a `Pin::get_unchcked(&mut capture)` inside the closure is unsound. This leads to actual miscompilations with `futures::join!`.

IMO the proper fix is to pin the closure when the future is pinned, which is achieved by changing the `Unpin` implementation. This is a breaking change though. 1.64.0 was *just* released, so maybe this is still okay?

The alternative would be to add some strong comments to the docs saying that closure captures are *not pinned* and doing `Pin::get_unchecked` on them is unsound.

19 months agoSpecialize ToString for Symbol
Cameron Steffen [Thu, 27 Oct 2022 21:14:48 +0000 (16:14 -0500)]
Specialize ToString for Symbol

19 months agoAdd a test for TAIT used with impl/dyn Trait inside RPIT
xxchan [Fri, 28 Oct 2022 20:58:19 +0000 (22:58 +0200)]
Add a test for TAIT used with impl/dyn Trait inside RPIT

19 months agorelative futex and condvar timeouts can work with isolation
Ralf Jung [Fri, 28 Oct 2022 14:13:10 +0000 (16:13 +0200)]
relative futex and condvar timeouts can work with isolation

19 months agoAuto merge of #2630 - RalfJung:windows-parking, r=RalfJung
bors [Fri, 28 Oct 2022 20:19:28 +0000 (20:19 +0000)]
Auto merge of #2630 - RalfJung:windows-parking, r=RalfJung

Implement thread parking for Windows

Cc https://github.com/rust-lang/miri/issues/2628

Based on code by `@DrMeepster.` However I adjusted `WakeByAddressSingle`: I don't think the futex value is compared *again* after the thread is woken up. I see nothing in the Windows docs indicating such a comparison, and the Linux futex does not behave like that either. So we only check the value before sleeping, same as on Linux.

19 months agoAuto merge of #103683 - fee1-dead-contrib:fix-deferred-cast-checks-constness, r=oli-obk
bors [Fri, 28 Oct 2022 19:28:41 +0000 (19:28 +0000)]
Auto merge of #103683 - fee1-dead-contrib:fix-deferred-cast-checks-constness, r=oli-obk

Retain ParamEnv constness when running deferred cast checks

Fixes #103677.

19 months agoEmit proper error when casting to Ddyn-star
Michael Goulet [Fri, 28 Oct 2022 17:32:34 +0000 (17:32 +0000)]
Emit proper error when casting to Ddyn-star

19 months agoAuto merge of #103071 - wesleywiser:fix_inlined_line_numbers, r=davidtwco
bors [Fri, 28 Oct 2022 16:27:56 +0000 (16:27 +0000)]
Auto merge of #103071 - wesleywiser:fix_inlined_line_numbers, r=davidtwco

Fix line numbers for MIR inlined code

`should_collapse_debuginfo` detects if the specified span is part of a
macro expansion however it does this by checking if the span is anything
other than a normal (non-expanded) kind, then the span sequence is
walked backwards to the root span.

This doesn't work when the MIR inliner inlines code as it creates spans
with expansion information set to `ExprKind::Inlined` and results in the
line number being attributed to the inline callsite rather than the
normal line number of the inlined code.

Fixes #103068

19 months agocleanup some test cfg
Ralf Jung [Fri, 28 Oct 2022 14:00:42 +0000 (16:00 +0200)]
cleanup some test cfg

19 months agotest most sync primitives on Windows
Ralf Jung [Fri, 28 Oct 2022 13:57:40 +0000 (15:57 +0200)]
test most sync primitives on Windows

19 months agosimplify Linux futex impl a bit
Ralf Jung [Fri, 28 Oct 2022 13:50:41 +0000 (15:50 +0200)]
simplify Linux futex impl a bit

19 months agothreadleak_ignored should now pass with preemption (the issue has been fixed a while...
Ralf Jung [Fri, 28 Oct 2022 13:48:58 +0000 (15:48 +0200)]
threadleak_ignored should now pass with preemption (the issue has been fixed a while ago)

19 months agoimplement thread parking on Windows
Ralf Jung [Fri, 28 Oct 2022 13:48:07 +0000 (15:48 +0200)]
implement thread parking on Windows

19 months agoAuto merge of #102674 - CastilloDel:master, r=oli-obk
bors [Fri, 28 Oct 2022 12:52:17 +0000 (12:52 +0000)]
Auto merge of #102674 - CastilloDel:master, r=oli-obk

Remove allow(rustc::potential_query_instability) in rustc_const_eval

The use of FxHashMap has been replaced with FxIndexMap.

Related to #84447

19 months agoRemove unneeded attribute.
Markus Reiter [Fri, 28 Oct 2022 12:17:34 +0000 (14:17 +0200)]
Remove unneeded attribute.

19 months agoRetain ParamEnv constness when running deferred cast checks
Deadbeef [Fri, 28 Oct 2022 11:46:12 +0000 (11:46 +0000)]
Retain ParamEnv constness when running deferred cast checks

Fixes #103677.

19 months agoAuto merge of #2627 - RalfJung:ignore-windows, r=RalfJung
bors [Fri, 28 Oct 2022 11:50:15 +0000 (11:50 +0000)]
Auto merge of #2627 - RalfJung:ignore-windows, r=RalfJung

update ignore-windows comments

Turns out 2 of these tests can actually be enabled. :)

19 months agoupdate ignore-windows comments
Ralf Jung [Fri, 28 Oct 2022 09:42:42 +0000 (11:42 +0200)]
update ignore-windows comments

19 months agoAuto merge of #103671 - matthiaskrgr:rollup-iuugpep, r=matthiaskrgr
bors [Fri, 28 Oct 2022 09:41:40 +0000 (09:41 +0000)]
Auto merge of #103671 - matthiaskrgr:rollup-iuugpep, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #102642 (Add tests for static async functions in traits)
 - #103283 (Add suggestions for unsafe impl error codes)
 - #103523 (Fix unwanted merge of inline doc comments for impl blocks)
 - #103550 (diagnostics: do not suggest static candidates as traits to import)
 - #103641 (Don't carry MIR location in `ConstraintCategory::CallArgument`)

Failed merges:

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

19 months agorustdoc-json-types: Improve ItemSummary::path docs
Nixon Enraght-Moony [Fri, 28 Oct 2022 00:43:37 +0000 (01:43 +0100)]
rustdoc-json-types: Improve ItemSummary::path docs

19 months agoAuto merge of #2626 - RalfJung:pthread_setname_np, r=RalfJung
bors [Fri, 28 Oct 2022 08:32:23 +0000 (08:32 +0000)]
Auto merge of #2626 - RalfJung:pthread_setname_np, r=RalfJung

pthread_setname_np returns an int on macOS

Fixes https://github.com/rust-lang/miri/issues/2625

19 months agopthread_setname_np returns an int on macOS
Ralf Jung [Fri, 28 Oct 2022 08:31:43 +0000 (10:31 +0200)]
pthread_setname_np returns an int on macOS

19 months agoAuto merge of #103672 - matthiaskrgr:rollup-dyk3civ, r=matthiaskrgr
bors [Fri, 28 Oct 2022 06:49:38 +0000 (06:49 +0000)]
Auto merge of #103672 - matthiaskrgr:rollup-dyk3civ, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #103585 (Migrate source line numbers CSS to CSS variables)
 - #103608 (Remap early bound lifetimes in return-position `impl Trait` in traits too)
 - #103609 (Emit a nicer error on `impl Self {`)
 - #103631 (Add test for issue 36007)
 - #103643 (rustdoc: stop hiding focus outlines on non-rustdoc-toggle details tags)
 - #103645 (Update cargo)

Failed merges:

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

19 months agoRollup merge of #103645 - weihanglo:update-cargo, r=weihanglo
Matthias Krüger [Fri, 28 Oct 2022 05:06:48 +0000 (07:06 +0200)]
Rollup merge of #103645 - weihanglo:update-cargo, r=weihanglo

Update cargo

6 commits in 9210810d1fd7b51ae0439a0a363cc50e36963455..7e484fc1a766f56dbc95380f45719698e0c82749 2022-10-25 22:31:50 +0000 to 2022-10-27 15:20:57 +0000
- fix(publish): Block until it is in index (rust-lang/cargo#11062)
- Add Accept-Encoding request header to enable compression (rust-lang/cargo#11292)
- Update contrib docs for highfive transition (rust-lang/cargo#11294)
- Migrate from highfive to triagebot (rust-lang/cargo#11293)
- Fix dupe word typos (rust-lang/cargo#11287)
- Fix confusing error messages when using -Zsparse-registry (rust-lang/cargo#11283)

19 months agoRollup merge of #103643 - notriddle:notriddle/summary-focus-visible, r=GuillaumeGomez
Matthias Krüger [Fri, 28 Oct 2022 05:06:47 +0000 (07:06 +0200)]
Rollup merge of #103643 - notriddle:notriddle/summary-focus-visible, r=GuillaumeGomez

rustdoc: stop hiding focus outlines on non-rustdoc-toggle details tags

We really shouldn't be overriding this kind of stuff unless the browser default is really broken (like outlining the thing that isn't clickable). This directly reverts b8f4e74cbc938d3448507d422c98061c2b71c922.

19 months agoRollup merge of #103631 - Rageking8:Add-test-for-issue-36007, r=compiler-errors
Matthias Krüger [Fri, 28 Oct 2022 05:06:47 +0000 (07:06 +0200)]
Rollup merge of #103631 - Rageking8:Add-test-for-issue-36007, r=compiler-errors

Add test for issue 36007

Fixes #36007

r? ``@compiler-errors``

19 months agoRollup merge of #103609 - BoxyUwU:fix_impl_self_cycle, r=compiler-errors
Matthias Krüger [Fri, 28 Oct 2022 05:06:46 +0000 (07:06 +0200)]
Rollup merge of #103609 - BoxyUwU:fix_impl_self_cycle, r=compiler-errors

Emit a nicer error on `impl Self {`

currently it emits a "cycle detected error" but this PR makes it emit a more user friendly error specifically saying that `Self` is disallowed in that position. this is a pretty hacky fix so i dont expect this to be merged (I basically only made this PR because i wanted to see if CI passes)

r? ``@compiler-errors``

19 months agoRollup merge of #103608 - compiler-errors:rpitit-early-lt, r=cjgillot
Matthias Krüger [Fri, 28 Oct 2022 05:06:46 +0000 (07:06 +0200)]
Rollup merge of #103608 - compiler-errors:rpitit-early-lt, r=cjgillot

Remap early bound lifetimes in return-position `impl Trait` in traits too

Fixes part of #103457

r? ``@cjgillot,`` though feel free to reassign, just thought you'd have sufficient context to review.

19 months agoRollup merge of #103585 - GuillaumeGomez:source-line-css, r=notriddle
Matthias Krüger [Fri, 28 Oct 2022 05:06:45 +0000 (07:06 +0200)]
Rollup merge of #103585 - GuillaumeGomez:source-line-css, r=notriddle

Migrate source line numbers CSS to CSS variables

Part of https://github.com/rust-lang/rust/pull/98460.

No UI changes.

r? ``@notriddle``

19 months agoRollup merge of #103641 - compiler-errors:issue-103624, r=cjgillot
Matthias Krüger [Fri, 28 Oct 2022 05:06:43 +0000 (07:06 +0200)]
Rollup merge of #103641 - compiler-errors:issue-103624, r=cjgillot

Don't carry MIR location in `ConstraintCategory::CallArgument`

It turns out that `ConstraintCategory::CallArgument` cannot just carry a MIR location in it, since we may bubble them up to totally different MIR bodies.

So instead, revert the commit a6b5f95fb028f9feb4a2957c06b35035be2c6155, and instead just erase regions from the original `Option<Ty<'tcx>>` that it carried, so that it doesn't ICE with the changes in #103220.

Best reviewed in parts -- the first is just a revert, and the second is where the meaningful changes happen.

Fixes #103624

19 months agoRollup merge of #103550 - notriddle:notriddle/no-suggest-static-candidates, r=wesleywiser
Matthias Krüger [Fri, 28 Oct 2022 05:06:43 +0000 (07:06 +0200)]
Rollup merge of #103550 - notriddle:notriddle/no-suggest-static-candidates, r=wesleywiser

diagnostics: do not suggest static candidates as traits to import

If it's a static candidate, then it's already implemented. Do not suggest it a second time for implementing.

Partial fix for #102354

19 months agoRollup merge of #103523 - GuillaumeGomez:inline-doc-comment-impl-block, r=notriddle
Matthias Krüger [Fri, 28 Oct 2022 05:06:42 +0000 (07:06 +0200)]
Rollup merge of #103523 - GuillaumeGomez:inline-doc-comment-impl-block, r=notriddle

Fix unwanted merge of inline doc comments for impl blocks

Fixes https://github.com/rust-lang/rust/issues/102909.

We need this merge mechanism for inlined items but it's completely unwanted for impl blocks (at least the doc comments are, not the other attributes) since we want to keep what `cfg()` is put on the `pub use` or other attributes.

r? ``@notriddle``

19 months agoRollup merge of #103283 - nbarrios1337:unsafe-impl-suggestions, r=cjgillot
Matthias Krüger [Fri, 28 Oct 2022 05:06:42 +0000 (07:06 +0200)]
Rollup merge of #103283 - nbarrios1337:unsafe-impl-suggestions, r=cjgillot

Add suggestions for unsafe impl error codes

Adds suggestions for users to add `unsafe` to trait impls that should be `unsafe`, and remove `unsafe` from trait impls that do not require `unsafe`

With the folllowing code:

```rust
struct Foo {}

struct Bar {}

trait Safe {}

unsafe trait Unsafe {}

impl Safe for Foo {} // ok

impl Unsafe for Foo {} // E0200

unsafe impl Safe for Bar {} // E0199

unsafe impl Unsafe for Bar {} // ok

// omitted empty main fn
```

The current rustc output is:
```
error[E0199]: implementing the trait `Safe` is not unsafe
  --> e0200.rs:13:1
   |
13 | unsafe impl Safe for Bar {} // E0199
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration
  --> e0200.rs:11:1
   |
11 | impl Unsafe for Foo {} // E0200
   | ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0199, E0200.
For more information about an error, try `rustc --explain E0199`.
```

With this PR, the future rustc output would be:
```
error[E0199]: implementing the trait `Safe` is not unsafe
  --> ../../temp/e0200.rs:13:1
   |
13 | unsafe impl Safe for Bar {} // E0199
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: remove `unsafe` from this trait implementation
   |
13 - unsafe impl Safe for Bar {} // E0199
13 + impl Safe for Bar {} // E0199
   |

error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration
  --> ../../temp/e0200.rs:11:1
   |
11 | impl Unsafe for Foo {} // E0200
   | ^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: the trait `Unsafe` enforces invariants that the compiler can't check. Review the trait documentation and make sure this implementation upholds those invariants before adding the `unsafe` keyword
help: add `unsafe` to this trait implementation
   |
11 | unsafe impl Unsafe for Foo {} // E0200
   | ++++++

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0199, E0200.
For more information about an error, try `rustc --explain E0199`.
```

``@rustbot`` label +T-compiler +A-diagnostics +A-suggestion-diagnostics

19 months agoRollup merge of #102642 - bryangarza:afit-tests, r=compiler-errors
Matthias Krüger [Fri, 28 Oct 2022 05:06:41 +0000 (07:06 +0200)]
Rollup merge of #102642 - bryangarza:afit-tests, r=compiler-errors

Add tests for static async functions in traits

This patch adds test cases for AFIT, the majority of which are currently expected to run as `check-fail`.

---

Note: I grabbed the cases from https://hackmd.io/SwRcXCiWQV-WRJ4BYs53fA

Also, I'm not sure if the `async-associated-types2` and `async-associated-types2-desugared` are correct, I modified them a bit from the examples in the HackMD.

19 months agoadd test for issue 98634
Rageking8 [Fri, 21 Oct 2022 10:37:35 +0000 (18:37 +0800)]
add test for issue 98634

19 months agoDo fewer passes and generally be more efficient when filtering tests
Ben Kimock [Tue, 26 Jul 2022 21:40:48 +0000 (17:40 -0400)]
Do fewer passes and generally be more efficient when filtering tests

19 months agorustdoc: remove redundant `div.search-container`
Michael Howell [Thu, 27 Oct 2022 20:36:27 +0000 (13:36 -0700)]
rustdoc: remove redundant `div.search-container`

This wrapper DIV was originally added in
89e1fb322321c05497caa01372ceb7d5b57fa680, when it allowed the search bar's
size to be calculated without using `calc()`. This `width` hack can be
removed using flexbox.