Commit Graph

236881 Commits

Author SHA1 Message Date
bjorn3
f414e265a7 Sync from rust 249624b504 2023-10-21 11:26:32 +00:00
Lukas Markeffsky
ccc4638d73 fix spans for removing .await on for expressions 2023-10-21 13:18:00 +02:00
bors
786c94a4eb Auto merge of #116734 - Nadrieril:lint-per-column, r=cjgillot
Lint `non_exhaustive_omitted_patterns` by columns

This is a rework of the `non_exhaustive_omitted_patterns` lint to make it more consistent. The intent of the lint is to help consumers of `non_exhaustive` enums ensure they stay up-to-date with all upstream variants. This rewrite fixes two cases we didn't handle well before:

First, because of details of exhaustiveness checking, the following wouldn't lint `Enum::C` as missing:
```rust
match Some(x) {
    Some(Enum::A) => {}
    Some(Enum::B) => {}
    _ => {}
}
```

Second, because of the fundamental workings of exhaustiveness checking, the following would treat the `true` and `false` cases separately and thus lint about missing variants:
```rust
match (true, x) {
    (true, Enum::A) => {}
    (true, Enum::B) => {}
    (false, Enum::C) => {}
    _ => {}
}
```
Moreover, it would correctly not lint in the case where the pair is flipped, because of asymmetry in how exhaustiveness checking proceeds.

A drawback is that it no longer makes sense to set the lint level per-arm. This will silently break the lint for current users of it (but it's behind a feature gate so that's ok).

The new approach is now independent of the exhaustiveness algorithm; it's a separate pass that looks at patterns column by column. This is another of the motivations for this: I'm glad to move it out of the algorithm, it was akward there.

This PR is almost identical to https://github.com/rust-lang/rust/pull/111651. cc `@eholk` who reviewed it at the time. Compared to then, I'm more confident this is the right approach.
2023-10-21 11:04:19 +00:00
bors
23af253fac Auto merge of #11539 - taiki-e:enforced-import-renames, r=Centri3
Warn missing_enforced_import_renames by default

Similar to https://github.com/rust-lang/rust-clippy/pull/8261 that did the same thing to disallowed_methods & disallowed_types.
This lint is also only triggered if import renames are defined in the `clippy.toml` file.

changelog: Moved [`missing_enforced_import_renames`] to `style` (Now warn-by-default)
[#11539](https://github.com/rust-lang/rust-clippy/pull/11539)
2023-10-21 10:40:29 +00:00
bors
6f97d838c6 Auto merge of #117013 - matthiaskrgr:rollup-mvgp54x, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #114521 (std: freebsd build update.)
 - #116911 (Suggest relaxing implicit `type Assoc: Sized;` bound)
 - #116917 (coverage: Simplify the injection of coverage statements)
 - #116961 (Typo suggestion to change bindings with leading underscore)
 - #116964 (Add stable Instance::body() and RustcInternal trait)
 - #116974 (coverage: Fix inconsistent handling of function signature spans)
 - #116990 (Mention `into_iter` on borrow errors suggestions when appropriate)
 - #116995 (Point at assoc fn definition on type param divergence)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-21 09:09:05 +00:00
Matthias Krüger
e9d18f5f78
Rollup merge of #116995 - estebank:issue-69944, r=compiler-errors
Point at assoc fn definition on type param divergence

When the number of type parameters in the associated function of an impl and its trait differ, we now *always* point at the trait one, even if it comes from a foreign crate. When it is local, we point at the specific params, when it is foreign, we point at the whole associated item.

Fix #69944.
2023-10-21 10:08:18 +02:00
Matthias Krüger
dd66bc86be
Rollup merge of #116990 - estebank:issue-68445, r=cjgillot
Mention `into_iter` on borrow errors suggestions when appropriate

If we encounter a borrow error on `vec![1, 2, 3].iter()`, suggest `into_iter`.

Fix #68445.
2023-10-21 10:08:18 +02:00
Matthias Krüger
e9df0b6b40
Rollup merge of #116974 - Zalathar:signature-spans, r=oli-obk,cjgillot
coverage: Fix inconsistent handling of function signature spans

While doing some more cleanup of `spans`, I noticed a strange inconsistency in how function signatures are handled. Normally the function signature span is treated as though it were executable as part of the start of the function, but in some cases the signature span disappears entirely from coverage, for no obvious reason.

This is caused by the fact that spans created by `CoverageSpan::for_fn_sig` don't add the span to their `merged_spans` field (unlike normal statement/terminator spans). In cases where the span-processing code looks at those merged spans, it thinks the signature span is no longer visible and deletes it.

Adding the signature span to `merged_spans` resolves the inconsistency.

(Prior to #116409 this wouldn't have been possible, because there was no case in the old `CoverageStatement` enum representing a signature. Now that `merged_spans` is just a list of spans, that's no longer an obstacle.)
2023-10-21 10:08:17 +02:00
Matthias Krüger
b7035198e6
Rollup merge of #116964 - celinval:smir-mono-body, r=oli-obk
Add stable Instance::body() and RustcInternal trait

The `Instance::body()` returns a monomorphized body.

For that, we had to implement visitor that monomorphize types and constants. We are also introducing the RustcInternal trait that will allow us to convert back from Stable to Internal.

Note that this trait is not yet visible for our users as it depends on Tables. We should probably add a new trait that can be exposed.

The tests here are very simple, and I'm planning on creating more exhaustive tests in the project-mir repo. But I was hoping to get some feedback here first.

r? ```@oli-obk```
2023-10-21 10:08:17 +02:00
Matthias Krüger
c5dd84d493
Rollup merge of #116961 - estebank:issue-60164, r=oli-obk
Typo suggestion to change bindings with leading underscore

When encountering a binding that isn't found but has a typo suggestion for a binding with a leading underscore, suggest changing the binding definition instead of the use place.

Fix #60164.
2023-10-21 10:08:16 +02:00
Matthias Krüger
ad574d9799
Rollup merge of #116917 - Zalathar:injection, r=cjgillot
coverage: Simplify the injection of coverage statements

This is a follow-up to #116046 that I left out of that PR because I didn't want to make it any larger.

After the various changes we've made to how coverage data is stored and transferred, the old code structure for injecting coverage statements into MIR is built around a lot of constraints that don't exist any more. We can simplify it by replacing it with a handful of loops over the BCB node/edge counters and the BCB spans.

---

`@rustbot` label +A-code-coverage
2023-10-21 10:08:16 +02:00
Matthias Krüger
3fd7175db4
Rollup merge of #116911 - estebank:issue-85378, r=oli-obk
Suggest relaxing implicit `type Assoc: Sized;` bound

Fix #85378.
2023-10-21 10:08:15 +02:00
Matthias Krüger
90671a0d70
Rollup merge of #114521 - devnexen:std_fbsd_13_upd, r=cuviper
std: freebsd build update.

since freebsd 11 had been removed, minimum is now 12.
2023-10-21 10:08:15 +02:00
bors
45a45c6e60 Auto merge of #117011 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2023-10-21 07:14:36 +00:00
Ralf Jung
49e8acbfe9 update lockfile 2023-10-21 08:41:45 +02:00
bors
49056df387 Auto merge of #3132 - rust-lang:rustup-2023-10-21, r=RalfJung
Automatic Rustup
2023-10-21 05:35:01 +00:00
The Miri Conjob Bot
8044a59a29 Merge from rustc 2023-10-21 05:23:43 +00:00
The Miri Conjob Bot
ee54d83b1f Preparing for merge from rustc 2023-10-21 05:14:07 +00:00
Zalathar
ff02d9200c coverage: Simplify the injection of coverage statements 2023-10-21 12:33:33 +11:00
Zalathar
6f1ca8d9eb coverage: Change query codegened_and_inlined_items to a plain function
This query has a name that sounds general-purpose, but in fact it has
coverage-specific semantics, and (fortunately) is only used by coverage code.

Because it is only ever called once (from one designated CGU), it doesn't need
to be a query, and we can change it to a regular function instead.
2023-10-21 12:20:05 +11:00
Zalathar
cdeeffde64 coverage: Move unused-function helpers closer to where they are used 2023-10-21 12:20:05 +11:00
Zalathar
e964ea5bf5 coverage: Emit mappings for unused functions without generating stubs 2023-10-21 12:20:05 +11:00
Zalathar
319693a927 coverage: Simplify initial creation of coverage spans 2023-10-21 11:56:15 +11:00
Zalathar
e16494469e coverage: Don't create an intermediate vec for each BCB's initial spans 2023-10-21 11:53:27 +11:00
Zalathar
a17ff82aae coverage: Handle fn signature spans more consistently near ? 2023-10-21 11:53:27 +11:00
Zalathar
dca42959bc coverage: Add a test showing the inconsistent handling of function signatures 2023-10-21 11:53:27 +11:00
Weihang Lo
45e74236aa
Update cargo 2023-10-20 18:56:53 -04:00
David Carlier
f4791420ab changes from feedback 2023-10-20 23:55:14 +01:00
Esteban Küber
939a224ce3 Point at assoc fn definition on type param divergence
When the number of type parameters in the associated function of an impl
and its trait differ, we now *always* point at the trait one, even if it
comes from a foreign crate. When it is local, we point at the specific
params, when it is foreign, we point at the whole associated item.

Fix #69944.
2023-10-20 22:11:01 +00:00
bors
249624b504 Auto merge of #116958 - oli-obk:coro, r=pnkfelix
rename Generator to Coroutine

implements https://github.com/rust-lang/compiler-team/issues/682

While I did an automated replacement, I went through all changes manually to avoid renaming things like "id generators", "code generator", ...

I renamed files where that was necessary due to the contents referring to the crate name itself (mir opt, codegen or debuginfo tests), or required by tidy (feature gate docs)

* [x] rename various remaining abbreviated references to generators.
* [x] rename files
* [x] rename folders
* [x] add renamed feature: `generators`, ...

r? `@ghost`
2023-10-20 21:20:57 +00:00
Oli Scherer
4b5ef37e21 Rename lots of files that had generator in their name 2023-10-20 21:14:02 +00:00
Oli Scherer
258af95a60 Replace all uses of generator in markdown documentation with coroutine 2023-10-20 21:14:02 +00:00
Oli Scherer
6fa47e15e7 bless miri 2023-10-20 21:14:02 +00:00
Oli Scherer
69c09ddb36 bless ui-fulldeps 2023-10-20 21:14:02 +00:00
Oli Scherer
6e8918ea1c Bless coverage map 2023-10-20 21:14:02 +00:00
Oli Scherer
3beadb5ebd Fix stage0 core tests 2023-10-20 21:14:02 +00:00
Oli Scherer
5c1872d7ae Rename generator folder 2023-10-20 21:14:02 +00:00
Oli Scherer
af93c20c06 Rename lots of files that had generator in their name 2023-10-20 21:14:02 +00:00
Oli Scherer
8c66e117e2 Re-add generators as a removed feature and point to the new feature name 2023-10-20 21:14:02 +00:00
Oli Scherer
82ffd58bfb Rename Gen to Coro in tests 2023-10-20 21:14:02 +00:00
Oli Scherer
d9259fdedd s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
4519e68957 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
0f739816c9 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
2d91c76d5d Rename CoroutineKind::Gen to ::Coroutine 2023-10-20 21:14:01 +00:00
Oli Scherer
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
868e513935 s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Oli Scherer
8e264ab07a s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Oli Scherer
60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
bors
96027d945b Auto merge of #116951 - compiler-errors:ir-file-structure, r=jackh726
Restructure `rustc_type_ir` a bit

1. Split `sty` into new `ty_kind`/`region_kind`/`const_kind` modules, so that when we uplift more kinds (e.g. `PredicateKind`, `ClauseKind`, and `ExistentialPredicate`), they can live in their own simple-to-understand files.
2. Split up the `structural_impls` module, which is a kitchen sink of random impls -- move `TypeFoldable` and `TypeVisitable` impls into existing `fold` and `visit` modules, respectively.
3. Move the `DebugWithInfcx` trait and blanket impls into a new `debug` module, and `TypeFlags` definition into a new `flags` module.
5. Move `Interner` trait into a new `interner` module. I expect this file to get a lot larger as we make the interner more powerful for the trait solver refactor.

r? `@ghost` for now, will assign once #116946 lands
2023-10-20 19:11:08 +00:00
Esteban Küber
88bccf454f Mention into_iter on borrow errors suggestions when appropriate
If we encounter a borrow error on `vec![1, 2, 3].iter()`, suggest
`into_iter`.

Fix #68445.
2023-10-20 18:50:25 +00:00