Commit Graph

199372 Commits

Author SHA1 Message Date
Nicholas Nethercote
a40124e01c Box CanonicalUserTypeAnnotation::CanonicalUserType.
This shrinks `Ascription`, which shrinks `PatKind::AscribeUserType`,
which shrinks `Pat`.
2022-09-02 07:26:22 +10:00
Nicholas Nethercote
2c4c8eb1a3 Box PatKind::Range.
Because it's the biggest variant. Also, make `PatRange` non-`Copy`,
because it's 104 bytes, which is pretty big.
2022-09-02 07:26:22 +10:00
Nicholas Nethercote
bd1e6836a0 Avoid some clones.
`Builder::expr_into_pattern` has a single call site. Currently the
`pattern` argument at the call site is always cloned.

This commit changes things so that we instead do a clone within
`expr_into_pattern`, but only if the pattern has the
`PatKind::AscribeUserType` kind, and we only clone the annotation within
the pattern instead of the entire pattern.
2022-09-02 07:26:22 +10:00
Nicholas Nethercote
053874eecc Clean up THIR patterns.
`thir::Pat::kind` is a `Box<PatKind>`, which doesn't follow the usual
pattern in AST/HIR/THIR which is that the "kind" enum for a node is
stored inline within the parent struct.

This commit makes the `PatKind` directly inline within the `Pat`. This
requires using `Box<Pat>` in all the types that hold a `Pat.

Ideally, `Pat` would be stored in `Thir` like `Expr` and `Stmt` and
referred to with a `PatId` rather than `Box<Pat>`. But this is hard to
do because lots of `Pat`s get created after the destruction of the `Cx`
that does normal THIR building. But this does get us a step closer to
`PatId`, because all the `Box<Pat>` occurrences would be replaced with
`PatId` if `PatId` ever happened.

At 128 bytes, `Pat` is large. Subsequent commits will shrink it.
2022-09-02 07:26:17 +10:00
bors
93c52e41ec Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink
fix: Parse TypePathFn with preceding `::`

e.g. `impl Fn::() -> ()`.

Fixes #13157. This was the problem, not that the path was not at the end.

I could unify the parsing of `::` of TypePathFn with that of generic arg list, but some code relies on the `::` of generic arg list to be inside it.
2022-09-01 21:00:14 +00:00
Ralf Jung
f76eac4866 update Miri 2022-09-01 22:59:05 +02:00
bors
f23114c854 Auto merge of #13161 - ChayimFriedman2:pi-is-zero, r=jonas-schievink
fix: Lower float literals with underscores

Fixes #13155 (the problem was the `PI` is defined with `_f64` suffix). `PI` is still truncated, though, because `f64` cannot represent the value with full precision.
2022-09-01 20:51:22 +00: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
Adam-Gleave
33afe9724a Remove trailing whitespace 2022-09-01 17:32:00 +01: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
111
b37e645d80 Migrate limit error 2022-09-01 23:35:38 +08:00
111
00cd965046 Migrate OpaqueHiddenType mismatch 2022-09-01 23:35:38 +08:00
111
3e834a7a62 Migrate DropCheckOverflow 2022-09-01 23:35:38 +08:00
Adam-Gleave
9d0542b76d Document eager evaluation of bool::then_some argument 2022-09-01 16:09:25 +01: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
Vadim Petrochenkov
a0e21ff105 rustc_target: Refactor internal linker flavors slightly
Remove one unstable user-facing linker flavor (l4-bender)
2022-09-01 16:54:52 +03:00
Vadim Petrochenkov
7dc186ff7e rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors 2022-09-01 16:54:52 +03: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
bors
c4445e415a Auto merge of #13165 - Veykril:breakables, r=Veykril
Properly handle break resolution inside non-breakable expressions

We now diagnose invalid `continue` expressions and properly handle things like `async` blocks which prevent labels from resolving further. Cleaned this up since `label_break_value` is on the way to stabilization in rust (🎉 finally) and we weren't handling breaks for blocks properly yet.
2022-09-01 13:07:26 +00:00
Lukas Wirth
c6b7f45308 Don't run rust-2021-compatibility lints, our crates are already on 2021 2022-09-01 15:04:55 +02:00
Lukas Wirth
8110119fef Properly handle break resolution inside non-breakable expressions 2022-09-01 14:54:47 +02:00
Lukas Wirth
1e66a5a8ce Diagnose incorrect continue expressions 2022-09-01 14:41:38 +02:00
Lukas Wirth
d6fc4a9ea6 Simplify breakables handling 2022-09-01 14:41:37 +02: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
Guillaume Gomez
f5857d5c5e Move error code book into a sub folder 2022-09-01 13:38:00 +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