Commit Graph

209470 Commits

Author SHA1 Message Date
bors
fab0432952 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`
2022-10-30 10:52:04 +00:00
bors
e96c330af5 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
2022-10-30 08:09:59 +00:00
Dylan DPC
df74f07b18
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.
2022-10-30 11:50:28 +05:30
Dylan DPC
176a89f496
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`
2022-10-30 11:50:27 +05:30
Dylan DPC
8564ee8900
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.
2022-10-30 11:50:27 +05:30
Dylan DPC
3143472863
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`
2022-10-30 11:50:26 +05:30
Dylan DPC
b4cf523cb5
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](a819fecb8d/src/test/ui/impl-trait/impl_fn_associativity.rs).

There even is a test that `f0` compiles:
2f004d2d40/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 }
}
```
2022-10-30 11:50:26 +05:30
bors
b03502b35d 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
2022-10-30 05:22:37 +00:00
est31
7b55d17a2f Reduce span of let else irrefutable_let_patterns warning
Huge spans aren't good for IDE users as they underline constructs that
are possibly multiline.
2022-10-30 05:05:21 +01:00
bors
4827ceecb9 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
2022-10-30 02:26:41 +00:00
Josh Stone
f8a0cc2ca8 compiletest: set the dylib path when gathering target cfg
If the compiler is built with `rpath = false`, then it won't find its
own libraries unless the library search path is set. We already do that
while running the actual compiletests, but #100260 added another rustc
command for getting the target cfg.

    Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    thread 'main' panicked at 'error: failed to get cfg info from "[...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc"
    --- stdout

    --- stderr
    [...]/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-a2a76dc626cd02d2.so: cannot open shared object file: No such file or directory
    ', src/tools/compiletest/src/common.rs:476:13

Now the library path is set here as well, so it works without rpath.
2022-10-29 17:58:02 -07:00
bors
15ee24a2fa Auto merge of #103731 - Mark-Simulacrum:new-version, r=Mark-Simulacrum
Bump to 1.67.0

r? `@Mark-Simulacrum`
2022-10-29 23:25:13 +00:00
Michael Howell
3195388e82 rustdoc: add support for incoherent impls on structs and traits
Fixes #103170
2022-10-29 15:51:59 -07:00
yukang
55568419ac fix #103783, fix ICE checking transmutability of NaughtyLenArray 2022-10-30 06:21:27 +08:00
Matthias Krüger
9c5e61c2d2
Rollup merge of #103737 - notriddle:notriddle/margin, r=GuillaumeGomez
rustdoc: use CSS margin/padding shorthand when all are being set
2022-10-30 00:09:27 +02:00
Matthias Krüger
2bff9e2193
Rollup merge of #103726 - TaKO8Ki:avoid-&str-to-string-conversions, r=compiler-errors
Avoid unnecessary `&str` to `String` conversions
2022-10-30 00:09:26 +02:00
Matthias Krüger
6e20768e9d
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`
2022-10-30 00:09:26 +02:00
Matthias Krüger
e4821d743b
Rollup merge of #103715 - tshepang:consistency, r=Dylan-DPC
use consistent terminology

I did not see other traits using the "interface" word
2022-10-30 00:09:25 +02:00
Matthias Krüger
6460d3be00
Rollup merge of #103253 - notriddle:notriddle/test-case-masked-blanket-impl, r=Mark-Simulacrum
rustdoc: add test case for masked blanket impl
2022-10-30 00:09:25 +02:00
Matthias Krüger
3b12086574
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
2022-10-30 00:09:24 +02:00
Matthias Krüger
23ff93ce8d
Rollup merge of #102659 - Mark-Simulacrum:relnotes, r=Mark-Simulacrum
1.65.0 release notes

r? `@cuviper` (since you're writing the blog)
2022-10-30 00:09:24 +02:00
Matthias Krüger
22e320b2c9
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
2022-10-30 00:09:23 +02:00
Jacob Hoffman-Andrews
c9dbfe31e2
Move string literal into format string
Co-authored-by: Michael Howell <michael@notriddle.com>
2022-10-29 14:49:00 -07:00
Cameron Steffen
88d71504dd Use tcx.require_lang_item 2022-10-29 16:09:15 -05:00
Cameron Steffen
1c8e658820 Use LanguageItems::require less 2022-10-29 16:04:10 -05:00
Cameron Steffen
a6180ede5c Simplify lang item groups 2022-10-29 16:04:10 -05:00
Cameron Steffen
6621279a75 Cleanup weak lang items 2022-10-29 16:04:10 -05:00
Cameron Steffen
1e349fb0dd Use an array in LanguageItems 2022-10-29 16:04:10 -05:00
Cameron Steffen
f808430497 Factor out ITEM_REFS 2022-10-29 16:04:10 -05:00
Cameron Steffen
ebfa1f0185 Encode LangItem directly 2022-10-29 16:04:10 -05:00
Cameron Steffen
99de57ae13 Improve LanguageItems api 2022-10-29 16:04:04 -05:00
Jacob Hoffman-Andrews
0b0bf10533 Generate static file hashes once 2022-10-29 12:48:08 -07:00
Jacob Hoffman-Andrews
bf25334066 Make --static-root-path point to static.files 2022-10-29 12:47:51 -07:00
Jacob Hoffman-Andrews
f9e1f6ffdf rustdoc: add hash to filename of toolchain files
All static files used by rustdoc are now stored in static.files/ and
include a hash of their contents. They no longer include the contents of
the --resource-suffix flag. This clarifies caching semantics. Anything
in static.files can use Cache-Control: immutable because any updates
will show up as a new URL.

Invocation-specific files like crates-NN.js, search-index-NN.js,
and sidebar-items-NN.js still get the resource suffix.

The --disable-minification flag is removed because it would vary the
output of static files based on invocation flags. Instead, for
rustdoc development purposes it's preferable to symlink static files
to a non-minified copy for quick iteration.
2022-10-29 12:47:48 -07:00
Vadim Petrochenkov
f1850d4c9b rustc_middle: Remove unnecessary type parameter from AccessLevels 2022-10-29 23:36:56 +04:00
Vadim Petrochenkov
90f27f93bd rustdoc: Split effective visibilities from rustc from similar data built by rustdoc for external def-ids 2022-10-29 23:36:52 +04:00
Vadim Petrochenkov
3f21bdd994 rustdoc: Simplify modifications of effective visibility table 2022-10-29 23:17:17 +04:00
Mark Rousskov
3f56a823f2 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>
2022-10-29 15:07:00 -04:00
Mark Rousskov
b0db70e203 Drop miri cross-compile check for Windows 2022-10-29 14:24:44 -04:00
bors
5e97720429 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
2022-10-29 17:32:45 +00:00
Michael Howell
a3c56e0428 rustdoc: remove unnecessary .search-results { padding-bottom }
There's nothing underneath it anyway. The conversation on
b615c0c854 never really spelled out why it
was added.
2022-10-29 09:59:53 -07:00
Michael Howell
d490ff461c rustdoc: use CSS margin/padding shorthand when all are being set 2022-10-29 09:04:31 -07:00
Kitsu
137271ad73 Run rustfix test for 103317 case 2022-10-29 18:44:24 +03:00
Mark Rousskov
5984b1d86f Revert "Make the c feature for compiler-builtins opt-in instead of inferred"
This reverts commit 3acb505ee5
(PR #101833).

The changes in this commit caused several bugs or at least
incompatibilies. For now we're reverting this commit and will re-land it
alongside fixes for those bugs.
2022-10-29 10:49:05 -04:00
Mark Rousskov
4cc03c16ad Bump to 1.67.0 2022-10-29 10:28:52 -04:00
bors
68c836a904 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
2022-10-29 14:14:08 +00:00
Ralf Jung
d366471e58 interpret: fix align_of_val on packed types 2022-10-29 15:58:32 +02:00
Guillaume Gomez
6425764045
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.
2022-10-29 14:18:05 +02:00
Guillaume Gomez
679771f147
Rollup merge of #103699 - compiler-errors:dyn-star-cast-bad, r=TaKO8Ki
Emit proper error when casting to `dyn*`

Fixes #103679
2022-10-29 14:18:05 +02:00
Guillaume Gomez
05ab16b54e
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`
2022-10-29 14:18:04 +02:00