Commit Graph

199021 Commits

Author SHA1 Message Date
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
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
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
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
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
bors
9af618b62e Auto merge of #101239 - oli-obk:tracing_cleanup, r=estebank
Tracing cleanup

r? `@ghost`
2022-09-01 16:25:32 +00:00
Oli Scherer
3f1f694ca5 Adjust stderr file 2022-09-01 14:54:27 +00:00
Oli Scherer
1fc9ef1edd tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
Oli Scherer
ee3c835018 Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
Oli Scherer
d3b22c7267 Directly use the instrument macro instead of its full path 2022-09-01 14:53:46 +00:00
Takayuki Maeda
78e9bea598 do not suggest adding move to closure when move is already used 2022-09-01 23:50:51 +09:00
bors
fb888117da Auto merge of #100606 - cuviper:upgrade-linux-ci, r=Mark-Simulacrum
ci: Upgrade non-dist Linux testers from ubuntu:16.04 to 22.04

The main goal of updating to 22.04 is to get away from `llvm.allow-old-toolchain`.
A side benefit is that they can also use the system `cmake` instead of building one.
2022-09-01 13:21:03 +00:00
Guillaume Gomez
68d0094305 Add regression test for #101129 2022-09-01 14:31:41 +02:00
Guillaume Gomez
fb14ad06fa Correctly merge impl block cfg attributes with its parents 2022-09-01 14:31:27 +02:00
Nixon Enraght-Moony
c9f4af6e11 Fix typo in comment 2022-09-01 12:09:42 +01:00
bors
4f9898a794 Auto merge of #100958 - mikebenfield:workaround, r=nikic
compiler/rustc_codegen_ssa/src/mir/place.rs: Remove LLVM bug workaround

This memset was inserted as a workaround to Rust issue #34427, which was
an LLVM bug that apparently no longer manifests.
2022-09-01 10:30:10 +00:00
Quinn Painter
098725c2e2
Fix filename of armv4t-none-eabi.md
The filename differed from the link in SUMMARY.md, causing it to 404.
2022-09-01 10:23:15 +01:00
Mara Bos
a20318d94b Update outdated comment about output capturing in print_to. 2022-09-01 11:20:08 +02:00
bors
eac6c33bc6 Auto merge of #100869 - nnethercote:replace-ThinVec, r=spastorino
Replace `rustc_data_structures::thin_vec::ThinVec` with `thin_vec::ThinVec`

`rustc_data_structures::thin_vec::ThinVec` looks like this:
```
pub struct ThinVec<T>(Option<Box<Vec<T>>>);
```
It's just a zero word if the vector is empty, but requires two
allocations if it is non-empty. So it's only usable in cases where the
vector is empty most of the time.

This commit removes it in favour of `thin_vec::ThinVec`, which is also
word-sized, but stores the length and capacity in the same allocation as
the elements. It's good in a wider variety of situation, e.g. in enum
variants where the vector is usually/always non-empty.

The commit also:
- Sorts some `Cargo.toml` dependency lists, to make additions easier.
- Sorts some `use` item lists, to make additions easier.
- Changes `clean_trait_ref_with_bindings` to take a
  `ThinVec<TypeBinding>` rather than a `&[TypeBinding]`, because this
  avoid some unnecessary allocations.

r? `@spastorino`
2022-09-01 08:01:06 +00:00
bors
b32223fec1 Auto merge of #100707 - dzvon:fix-typo, r=davidtwco
Fix a bunch of typo

This PR will fix some typos detected by [typos].

I only picked the ones I was sure were spelling errors to fix, mostly in
the comments.

[typos]: https://github.com/crate-ci/typos
2022-09-01 05:39:58 +00:00
bors
aa857eb953 Auto merge of #100537 - petrochenkov:piccheck, r=oli-obk
rustc_target: Add some more target spec sanity checking
2022-09-01 03:13:46 +00:00
Andrew Pollack
d8b572b820 Tweaks to fuchsia doc walkthrough 2022-09-01 00:35:30 +00:00
bors
3892b7074d Auto merge of #100210 - mystor:proc_macro_diag_struct, r=eddyb
proc_macro/bridge: send diagnostics over the bridge as a struct

This removes some RPC when creating and emitting diagnostics, and
simplifies the bridge slightly.

After this change, there are no remaining methods which take advantage
of the support for `&mut` references to objects in the store as
arguments, meaning that support for them could technically be removed if
we wanted. The only remaining uses of immutable references into the
store are `TokenStream` and `SourceFile`.

r? `@eddyb`
2022-09-01 00:26:53 +00:00
Michael Howell
037a911bd8 rustdoc: remove unused .docblock .impl-items CSS
The impl-items list stopped being nested inside a docblock since c1b1d6804b
2022-08-31 15:47:48 -07:00
bors
db00199d99 Auto merge of #101249 - matthiaskrgr:rollup-wahnoz8, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #100787 (Pretty printing give proper error message without panic)
 - #100838 (Suggest moving redundant generic args of an assoc fn to its trait)
 - #100844 (migrate rustc_query_system to use SessionDiagnostic)
 - #101140 (Update Clippy)
 - #101161 (Fix uintended diagnostic caused by `drain(..)`)
 - #101165 (Use more `into_iter` rather than `drain(..)`)
 - #101229 (Link “? operator” to relevant chapter in The Book)
 - #101230 (lint: avoid linting diag functions with diag lints)
 - #101236 (Avoid needless buffer zeroing in `std::sys::windows::fs`)
 - #101240 (Fix a typo on `wasm64-unknown-unknown` doc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-31 21:45:18 +00:00
Matt Hamrick
a928255ab1
Fix bad target name in Walkthrough
Walkthrough currently say:

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

```
rustup target add aarch64-fuchsia
```
2022-08-31 13:21:47 -07:00
Matthias Krüger
14d216d33b
Rollup merge of #101240 - JohnTitor:JohnTitor-patch-1, r=ehuss
Fix a typo on `wasm64-unknown-unknown` doc
2022-08-31 21:30:18 +02:00
Matthias Krüger
3da66f0353
Rollup merge of #101236 - thomcc:winfs-nozero, r=ChrisDenton
Avoid needless buffer zeroing in `std::sys::windows::fs`

Followup to https://github.com/rust-lang/rust/pull/101171 and https://github.com/rust-lang/rust/pull/101193. This finishes up avoiding buffer zeroing pointed out in https://github.com/rust-lang/rust/pull/100729#issuecomment-1220055311 (thanks!)

r? `@ChrisDenton`
2022-08-31 21:30:17 +02:00
Matthias Krüger
0620f6e90a
Rollup merge of #101230 - davidtwco:translation-internal-lint-no-self-lint, r=fee1-dead
lint: avoid linting diag functions with diag lints

Functions annotated with `#[rustc_lint_diagnostics]` are used by the diagnostic migration lints to know when to lint, but functions that are annotated with this attribute shouldn't themselves be linted.

cc #100717 https://github.com/rust-lang/rust/pull/101041#discussion_r959303706
2022-08-31 21:30:16 +02:00
Matthias Krüger
c30c42ee29
Rollup merge of #101229 - mgeisler:link-try-operator, r=thomcc
Link “? operator” to relevant chapter in The Book

Before, the text simply asked people to use a symbol which is hard to
search for. Now the text links back to the chapter on error
propagation in The Book. That should help people find the relevant
keywords for further searches.
2022-08-31 21:30:15 +02:00
Matthias Krüger
e5356712b9
Rollup merge of #101165 - ldm0:drain_to_iter, r=cjgillot
Use more `into_iter` rather than `drain(..)`

Clearer semantic.
2022-08-31 21:30:13 +02:00
Matthias Krüger
f378155fb6
Rollup merge of #101161 - ldm0:ldm_fix_diagnostic, r=cjgillot
Fix uintended diagnostic caused by `drain(..)`

Calling `drain(..)` makes later `suggestable_variants.is_empty()` always true, which makes the diagnostics unintended.
2022-08-31 21:30:12 +02:00
Matthias Krüger
ba0011cbfb
Rollup merge of #101140 - Jarcho:clippyup, r=Jarcho
Update Clippy

r? ```@Manishearth```
2022-08-31 21:30:11 +02:00