Commit Graph

199060 Commits

Author SHA1 Message Date
Matthias Krüger
5a23efd31e
Rollup merge of #101215 - est31:rustdoc_version_placeholder, r=Mark-Simulacrum
Also replace the version placeholder in rustc_attr

Replace the version placeholder with the current version in the rustc_attr crate too so that users won't see the placeholder but instead the explicit version. This especially fixes the bug for rustdoc not showing it but instead the placeholder.

Originally reported [here](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/libs.20stabilization.20placeholder/near/296057188).

cc #100591

![Screenshot_20220830_233727](https://user-images.githubusercontent.com/8872119/187548079-6207776b-4481-4351-afff-607f5b3fe03a.png)
2022-09-02 18:22:01 +02:00
Matthias Krüger
c8749f0453
Rollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco
Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1

``@rustbot`` label +A-translation

r? rust-lang/diagnostics
cc #100717
2022-09-02 18:22:00 +02:00
Matthias Krüger
ed37111205
Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-Simulacrum
Change implementation of `-Z gcc-ld` and `lld-wrapper` again

This PR partially reverts https://github.com/rust-lang/rust/pull/97375 and uses the strategy described in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520 instead, thus fixes https://github.com/rust-lang/rust/issues/97755.
2022-09-02 18:21:59 +02:00
Matthias Krüger
938897e2e4
Rollup merge of #100121 - Nilstrieb:mir-validator-param-env, r=oli-obk
Try normalizing types without RevealAll in ParamEnv in MIR validation

Before, the MIR validator used RevealAll in its ParamEnv for type
checking. This could cause false negatives in some cases due to
RevealAll ParamEnvs not always use all predicates as expected here.

Since some MIR passes like inlining use RevealAll as well, keep using
it in the MIR validator too, but when it fails usign RevealAll, also
try the check without it, to stop false negatives.

Fixes #99866

cc ````````@compiler-errors```````` who nicely helped me on zulip
2022-09-02 18:21:58 +02:00
bors
9353538c7b Auto merge of #101318 - GuillaumeGomez:rollup-qsr51z4, r=GuillaumeGomez
Rollup of 9 pull requests

Successful merges:

 - #97739 (Uplift the `let_underscore` lints from clippy into rustc.)
 - #99583 (Add additional methods to the Demand type)
 - #100147 (optimization of access level table construction)
 - #100552 (rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors)
 - #100827 (Simplify MIR opt tests)
 - #101166 (Generate error index with mdbook instead of raw HTML pages)
 - #101294 (Fix #100844 rebase accident)
 - #101298 (rustdoc: remove unused CSS `#main-content > .since`)
 - #101304 (Add autolabels for `A-query-system`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-02 10:55:24 +00:00
Guillaume Gomez
138121a5ba
Rollup merge of #101304 - jyn514:jnelson/tag-query-system, r=Dylan-DPC
Add autolabels for `A-query-system`

r? `@cjgillot`
2022-09-02 11:34:55 +02:00
Guillaume Gomez
3880925e2c
Rollup merge of #101298 - notriddle:notriddle/rustdoc-main-since, r=GuillaumeGomez
rustdoc: remove unused CSS `#main-content > .since`

This rule was added (actually, it was called `#main > .since` back then) with cdca084377 and you can see an example of the bug it's intended to fix in <https://doc.rust-lang.org/1.9.0/std/fmt/fn.write.html> by looking at the `1.0.0` version marker.

However, a5a2f2b951 changed it so that `<span class="since">` is always placed in an out-of-band wrapper, so it's never nested directly below `#main` / `#main-content` any more.
2022-09-02 11:34:54 +02:00
Guillaume Gomez
4c1b6b5cd8
Rollup merge of #101294 - Xiretza:fix-100844-accident, r=davidtwco
Fix #100844 rebase accident

This undoes the rebase accident in #100844, which accidentally caused #100970 to be reverted.
2022-09-02 11:34:53 +02:00
Guillaume Gomez
68d3cfac47
Rollup merge of #101166 - GuillaumeGomez:error-index-mdbook, r=notriddle
Generate error index with mdbook instead of raw HTML pages

This is a follow-up of https://github.com/rust-lang/rust/pull/100922.

This comes from a remark from ````@estebank```` who said that the search was a nice thing on the previous version and that it wasn't possible anymore. An easy way to come around this limitation was to use `mdbook`, which is what I did here.

Now some explanations on the code. I'll explain how I developed this and why I reached this solution. First I did it very basically by simply setting the source directory and the output directory, generated a `SUMMARY.md` manually which listed all error codes and that was it. Two problems arose from this:
 1. A lot of new HTML files were generated at the top level
 2. An `index.html` file was generated at the top-level (the summary in short).

So for `1.`, it's not great to have too many files at the top-level as it could create file conflicts more easily. And for `2.`, this is actually a huge issue because <doc.rust-lang.org> generates an `index.html` file with a links to a few different resources, so it should never be overwritten. <s>Unfortunately, `mdbook` **always** generates an `index.html` file so the only solution I could see (except for sending them a contribution, I'll maybe do that later) was to temporaly move a potentially existing `index.html` file and then puts it back once done. For this last part, to ensure that we don't return *before* it has been put back, I wrapped the `mdbook` generation code inside `render_html_inner` which is called from `render_html` which in turn handle the "save" of `index.html`.</s>

EDIT: `mdbook` completely deletes ALL the content in the target directory so I instead generate into a sub directory and then I move the files to the real target directory.

To keep compatibility with the old version, I also put the `<script>` ````@notriddle```` nicely provided in the previous PR only into the `error-index.html` file to prevent unneeded repetition. I didn't use `mdbook` `additional-js` option because the JS is included at the end of all HTML files, which we don't want for two reasons:
 1. It's slow.
 2. We only want it to be run in `error-index.html` (even if we also ensure in the JS itself too!).

<s>Now the last part: why we generate the summary twice. We actually generate it once to tell `mdbook` what the book will look like and a second time because a create a new chapter content which will actually list all the error codes (with the updated paths).</s>

EDIT: I removed the need for two summaries.

You can test it [here](https://rustdoc.crud.net/imperio/error-index-mdbook/error-index.html).

r? ````@notriddle````
2022-09-02 11:34:51 +02:00
Guillaume Gomez
203526e576
Rollup merge of #100827 - JakobDegen:better-tests, r=wesleywiser
Simplify MIR opt tests

This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due to having excessively strong opinions over *how* a piece of code should be optimized.

Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for code where we want to track what the end to end effect of the optimization pipeline on the example code is.

r? `````@wesleywiser`````
2022-09-02 11:34:50 +02:00
Guillaume Gomez
edf79cb86b
Rollup merge of #100552 - petrochenkov:flavorcompat, r=lqd
rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors

I want to do some refactorings in `rustc_target` - merge `lld_flavor` and `linker_is_gnu` into `linker_flavor`, support combination gcc+lld (https://github.com/rust-lang/rust/pull/96827).
This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces - `-Clinker-flavor` values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.)

The second commit does some light refactoring of internal linker flavors (applies changes from 53eca42973 that don't require mass-editing target specs).
2022-09-02 11:34:49 +02:00
Guillaume Gomez
1aaf9aec95
Rollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov
optimization of access level table construction

Refactoring which was mentioned in #87487
2022-09-02 11:34:48 +02:00
Guillaume Gomez
0e82dc969f
Rollup merge of #99583 - shepmaster:provider-plus-plus, r=yaahc
Add additional methods to the Demand type

This adds on to the original tracking issue #96024

r? `````@yaahc`````
2022-09-02 11:34:46 +02:00
Guillaume Gomez
07f43a1ca1
Rollup merge of #97739 - a2aaron:let_underscore, r=estebank
Uplift the `let_underscore` lints from clippy into rustc.

This PR resolves #97241.

This PR adds three lints from clippy--`let_underscore_drop`, `let_underscore_lock`, and `let_underscore_must_use`, which are meant to capture likely-incorrect uses of `let _ = ...` bindings (in particular, doing this on a type with a non-trivial `Drop` causes the `Drop` to occur immediately, instead of at the end of the scope. For a type like `MutexGuard`, this effectively releases the lock immediately, which is almost certainly the wrong behavior)

In porting the lints from clippy I had to copy over a bunch of utility functions from `clippy_util` that these lints also relied upon. Is that the right approach?

Note that I've set the `must_use` and `drop` lints to Allow by default and set `lock` to Deny by default (this matches the same settings that clippy has). In talking with `@estebank` he informed me to do a Crater run (I am not sure what type of Crater run to request here--I think it's just "check only"?)

On the linked issue, there's some discussion about using `must_use` and `Drop` together as a heuristic for when to warn--I did not implement this yet.

r? `@estebank`
2022-09-02 11:34:45 +02:00
bors
e21d771b9c Auto merge of #100943 - jyn514:query-system-2, r=cjgillot
Simplify the `define_query` macro

This moves a bunch of control flow out of the macro into generic functions, leaving the macro just to call the function with a new generic parameter for each query.

It may be possible to improve compile-times / icache by instantiating the generic functions only with the query key, not the query type itself, but I'm going to leave that for a follow-up PR.

Helps with https://github.com/rust-lang/rust/issues/96524.

r? `@cjgillot`
2022-09-02 08:28:08 +00:00
Jakob Degen
e5d60af3c6 Simplify MIR opt tests
This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These
tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due
to having excessively strong opinions over *how* a piece of code should be optimized.

Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for
code where we want to track what the result of the net result of the optimization pipeline's output
is.
2022-09-01 23:01:53 -07:00
bors
b10aed0084 Auto merge of #100935 - cuviper:upgrade-android-ci, r=Mark-Simulacrum
ci: Upgrade android containers from ubuntu:16.04 to 22.04

The main goal of updating to 22.04 is to get away from `llvm.allow-old-toolchain`.
These containers are not building LLVM for android, so only the host version matters.
A side benefit is that they can also use the system `cmake` instead of building one.
2022-09-02 05:32:57 +00:00
bors
301348077d Auto merge of #100395 - Dylan-DPC:rollup-ajrwo1s, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #92744 (Check if enum from foreign crate has any non exhaustive variants when attempting a cast)
 - #99337 (rustdoc: simplify highlight.rs)
 - #100007 (Never inline Windows dtor access)
 - #100030 (cleanup code w/ pointers in std a little)
 - #100192 ( Remove duplicated temporaries creating during box derefs elaboration)
 - #100247 (Generalize trait object generic param check to aliases.)
 - #100374 (Improve crate selection on rustdoc search results page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-02 03:16:32 +00:00
Joshua Nelson
1cd28639c9 Add autolabels for A-query-system 2022-09-01 20:49:12 -05:00
bors
e4f049312c Auto merge of #101248 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
Fixes https://github.com/rust-lang/rust/issues/101067
2022-09-02 00:53:50 +00:00
Joshua Nelson
4e09a13bb8 Don't create two new closures for each query
- Parameterize DepKindStruct over `'tcx`

    This allows passing in an invariant function pointer in `query_callback`,
    rather than having to try and make it work for any lifetime.

- Add a new `execute_query` function to `QueryDescription` so we can call `tcx.$name` without needing to be in a macro context
2022-09-01 18:47:54 -05:00
Joshua Nelson
4fcc745266 Simplify try_load_from_on_disk_cache 2022-09-01 18:47:54 -05:00
Joshua Nelson
83b6dc9588 Move almost all of the function in query_callbacks to a generic function 2022-09-01 18:47:54 -05:00
est31
0c4ec5df58 Also replace the version placeholder in rustc_attr
This fixes rustdoc not showing the current version as stabilization version
for recently stabilized lang features.
2022-09-02 01:47:01 +02:00
Joshua Nelson
8f442e8ded Get rid of fn recover 2022-09-01 18:42:31 -05:00
Joshua Nelson
70f20ac40e Move force_with_dep_node outside the giant macro 2022-09-01 18:42:30 -05:00
Joshua Nelson
375d78012f Move try_on_disk_cache out of the giant macro 2022-09-01 18:42:26 -05:00
Joshua Nelson
1cf7bcc388 Get rid of make_query module 2022-09-01 18:34:37 -05:00
Michael Howell
096efc29f1 rustdoc: remove unused CSS #main-content > .since
This rule was added (actually, it was called `#main > .since` back then) with
cdca084377 and you can see an example of the
bug it's intended to fix in <https://doc.rust-lang.org/1.9.0/std/fmt/fn.write.html>
by looking at the `1.0.0` version marker.

However, a5a2f2b951 changed it so that
`<span class="since">` is always placed in an out-of-band wrapper, so it's
never nested directly below `#main` / `#main-content` any more.
2022-09-01 15:25:22 -07:00
bors
10706d62da Auto merge of #101295 - matthiaskrgr:rollup-046o38p, r=matthiaskrgr
Rollup of 14 pull requests

Successful merges:

 - #94467 (Add `special_module_name` lint)
 - #100852 (Use `getuid` to check instead of `USER` env var in rustbuild)
 - #101072 (bootstrap: Add llvm-has-rust-patches target option)
 - #101190 (Make docs formulation more consistent for NonZero{int})
 - #101245 (Remove unneeded where whitespace)
 - #101251 (Fix  bad target name in Walkthrough)
 - #101254 (rustdoc: remove unused `.docblock .impl-items` CSS)
 - #101256 (Fixes/adjustments to Fuchsia doc walkthrough)
 - #101270 (Update outdated comment about output capturing in print_to.)
 - #101271 (Fix filename of armv4t-none-eabi.md)
 - #101274 (Fix typo in comment)
 - #101279 (Fix doc_auto_cfg for impl blocks in different modules with different `cfg`)
 - #101285 (Do not suggest adding `move` to closure when `move` is already used)
 - #101292 (rustdoc: remove unneeded CSS `.content table td:first-child > a`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-01 22:12:32 +00:00
Ralf Jung
f76eac4866 update Miri 2022-09-01 22:59:05 +02:00
Matthias Krüger
1c12dedd53
Rollup merge of #101292 - rust-lang:notriddle/rustdoc-table-first-child, r=GuillaumeGomez
rustdoc: remove unneeded CSS `.content table td:first-child > a`

This rule was added in c1c6175e62 to benefit the module items table. However, the module items table stopped using table tags when 6020c79dde switched us over to grid layout.
2022-09-01 21:37:23 +02:00
Matthias Krüger
1bafe0b020
Rollup merge of #101285 - TaKO8Ki:do-not-suggest-adding-move-when-closure-is-already-marked-as-move, r=oli-obk
Do not suggest adding `move` to closure when `move` is already used

Fixes #101227
2022-09-01 21:37:21 +02:00
Matthias Krüger
8f8a5d2723
Rollup merge of #101279 - GuillaumeGomez:doc_auto_cfg_nested_impl, r=notriddle
Fix doc_auto_cfg for impl blocks in different modules with different `cfg`

Fixes #101129.

Just like reexports, impl blocks don't necessarily share the same "space" as the item they implement so we need to merge attributes from its parents as well.

r? `@notriddle`
2022-09-01 21:37:20 +02:00
Matthias Krüger
e9df5ddda2
Rollup merge of #101274 - aDotInTheVoid:comment-typo, r=TaKO8Ki
Fix typo in comment
2022-09-01 21:37:19 +02:00
Matthias Krüger
754cb2a6f0
Rollup merge of #101271 - QuinnPainter:patch-1, r=Dylan-DPC
Fix filename of armv4t-none-eabi.md

The filename differed from the link in SUMMARY.md, causing it to 404.
2022-09-01 21:37:17 +02:00
Matthias Krüger
b36fd55804
Rollup merge of #101270 - m-ou-se:update-comment, r=joshtriplett
Update outdated comment about output capturing in print_to.
2022-09-01 21:37:16 +02:00
Matthias Krüger
cbcea24824
Rollup merge of #101256 - andrewpollack:fuchsia-docs-adding, r=tmandry
Fixes/adjustments to Fuchsia doc walkthrough

Small fixes/adjustments missed during #100927
2022-09-01 21:37:15 +02:00
Matthias Krüger
418748ff6b
Rollup merge of #101254 - rust-lang:notriddle/remove-even-more-css, r=jsha
rustdoc: remove unused `.docblock .impl-items` CSS

The impl-items list stopped being nested inside a docblock since c1b1d6804b
2022-09-01 21:37:14 +02:00
Matthias Krüger
f6c7c4edba
Rollup merge of #101251 - diminishedprime:patch-1, r=JohnTitor
Fix  bad target name in Walkthrough

Walkthrough currently say:

```
rustup target add aarch_64-fuchsia
```
but should say

```
rustup target add aarch64-fuchsia
```
2022-09-01 21:37:12 +02:00
Matthias Krüger
21c8447d78
Rollup merge of #101245 - GuillaumeGomez:remove-unneeded-where-whitespace, r=notriddle
Remove unneeded where whitespace

It fixes these two bugs:

![Screenshot from 2022-08-31 18-14-40](https://user-images.githubusercontent.com/3050060/187727950-94657419-abfa-454c-9d27-004280fbcb45.png)
![Screenshot from 2022-08-31 18-14-49](https://user-images.githubusercontent.com/3050060/187727956-21d1b39d-62d7-4e7b-8f6f-631ceda67a19.png)

It's a relic from a very old time (this commit: bfd01b7f40).

You can test the result [here](https://rustdoc.crud.net/imperio/remove-unneeded-where-whitespace/lib2/struct.WhereWhitespace.html).

cc `````````@jsha`````````
r? `````````@notriddle`````````
2022-09-01 21:37:11 +02:00
Matthias Krüger
36d050645f
Rollup merge of #101190 - yjhn:patch-1, r=Mark-Simulacrum
Make docs formulation more consistent for NonZero{int}

Use third person, as it is used for other `std` documentation.
2022-09-01 21:37:10 +02:00
Matthias Krüger
1c0561aca6
Rollup merge of #101072 - tmandry:llvm-is-vanilla, r=Mark-Simulacrum
bootstrap: Add llvm-has-rust-patches target option

This is so you can check out an upstream commit in src/llvm-project and
have everything just work.

This simplifies the logic in `is_rust_llvm` a bit; it doesn't need to
check for download-ci-llvm because we would have already errored if both
that and llvm-config were specified on the host platform.
2022-09-01 21:37:09 +02:00
Matthias Krüger
b05f97d594
Rollup merge of #100852 - Samyak2:samyak/100459, r=Mark-Simulacrum
Use `getuid` to check instead of `USER` env var in rustbuild

This makes it consistent with `x.py` as changed in #95671

Fixes #100459
2022-09-01 21:37:08 +02:00
Matthias Krüger
da1d738601
Rollup merge of #94467 - ibraheemdev:master, r=pnkfelix
Add `special_module_name` lint

Declaring `lib` as a module is one of the most common beginner mistakes when trying to setup a binary and library target in the same crate. `special_module_name` lints against it, as well as `mod main;`
```
warning: found module declaration for main.rs
  --> $DIR/special_module_name.rs:4:1
   |
LL | mod main;
   | ^^^^^^^^^
   |
   = note: a binary crate cannot be used as library

warning: found module declaration for lib.rs
  --> $DIR/special_module_name.rs:1:1
   |
LL | mod lib;
   | ^^^^^^^^
   |
   = note: `#[warn(special_module_name)]` on by default
   = note: lib.rs is the root of this crate's library target
   = help: to refer to it from other targets, use the library's name as the path
   ```

Note that the help message is not the best in that it doesn't provide an example of an import path (`the_actual_crate_name::`), and doesn't check whether the current file is part of a library/binary target to provide more specific error messages. I'm not sure where this lint would have to be run to access that information.
2022-09-01 21:37:07 +02:00
bors
2e35f954ad Auto merge of #98960 - cjgillot:entry-kind, r=estebank
Remove EntryKind from metadata.

This PR continues the refactor of metadata emission to be more systematic, iterating on definitions and filtering based on each definition's `DefKind`. This allows to remove the large `EntryKind` enum, replaced by linear tables in metadata.
2022-09-01 19:31:14 +00:00
Xiretza
d9b874c083 Allow deriving multiple subdiagnostics using one SessionSubdiagnostic
This reimplements ac638c1, which had to be reverted in the previous
commit because it contains a rebase accident that itself reverted
significant unrelated changes to SessionSubdiagnostic.
2022-09-01 21:18:01 +02:00
Michael Howell
31071336f5 rustdoc: remove unneeded CSS .content table td:first-child > a
This rule was added in c1c6175e62 to benefit
the module items table. However, the module items table stopped using table
tags when 6020c79dde switched us over to grid
layout.
2022-09-01 11:38:54 -07:00
Gabriel Bustamante
8e82200277 Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1 2022-09-01 12:54:50 -05:00
Xiretza
9df75ee254 Revert parts of "use derive proc macro to impl SessionDiagnostic"
This reverts parts of commit ac638c1f5f.

During rebase, this commit accidentally reverted unrelated changes to
the subdiagnostic derive (those allowing multipart_suggestions to be
derived). This commit reverts all changes to the subdiagnostic code made
in ac638c1f5f, the next commit will reintroduce the actually intended
changes.
2022-09-01 19:42:49 +02:00