Commit Graph

17403 Commits

Author SHA1 Message Date
lcnr
1fc86a63f4 rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00
bors
de0b511daa Auto merge of #102189 - davidtwco:translation-derive-enums, r=compiler-errors
macros: diagnostic derive on enums

Part of #100717.

Extends `#[derive(Diagnostic)]` to work on enums too where each variant acts like a distinct diagnostic - being able to represent diagnostics this way can be quite a bit simpler for some parts of the compiler.

r? `@compiler-errors`
cc `@Xiretza`
2022-09-27 04:39:25 +00:00
bors
8b705839cd Auto merge of #102324 - matthiaskrgr:rollup-6l70oz3, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #101875 (Allow more `!Copy` impls)
 - #101996 (Don't duplicate region names for late-bound regions in print of Binder)
 - #102181 (Add regression test)
 - #102273 (Allow `~const` bounds on non-const functions)
 - #102286 (Recover some items that expect braces and don't take semicolons)

Failed merges:

 - #102314 (Add a label to struct/enum/union ident name)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-26 19:57:51 +00:00
Matthias Krüger
6f5e8c2ed4
Rollup merge of #102286 - compiler-errors:recover-semi-in-block-item, r=davidtwco
Recover some items that expect braces and don't take semicolons

Fixes #102262
2022-09-26 19:19:21 +02:00
Matthias Krüger
e9bec2fdd4
Rollup merge of #102273 - woppopo:relax_const_bound, r=fee1-dead
Allow `~const` bounds on non-const functions

Makes the behavior of bound of trait-associated functions and non-associated functions consistent.
2022-09-26 19:19:21 +02:00
Matthias Krüger
b02062e886
Rollup merge of #101996 - b-naber:binder-print, r=lcnr
Don't duplicate region names for late-bound regions in print of Binder

Fixes https://github.com/rust-lang/rust/issues/101280
2022-09-26 19:19:20 +02:00
Matthias Krüger
4d4a3691e9
Rollup merge of #101875 - fmease:allow-more-negative-copy-impls, r=lcnr
Allow more `!Copy` impls

You can already implement `!Copy` for a lot of types (with `#![feature(negative_impls)]`). However, before this PR you could not implement `!Copy` for ADTs whose fields don't implement `Copy` which didn't make any sense. Further, you couldn't implement `!Copy` for types impl'ing `Drop` (equally nonsensical).

``@rustbot`` label T-types F-negative_impls
Fixes #101836.

r? types
2022-09-26 19:19:19 +02:00
bors
1d1f142660 Auto merge of #102257 - cjgillot:let-else-lint, r=dingxiangfei2009
Fix lint scoping for let-else.

The scoping for let-else is inconsistent with HIR nesting.  This creates cases, in `ui/let-else/let-else-allow-unused.rs` for instance, where an `allow` lint attribute does not apply to the bindings created by `let-else`.

This PR is an attempt to correct this.

As there is no lint that currently relies on this, the test for this behaviour is https://github.com/rust-lang/rust/pull/101500.

cc `@dingxiangfei2009` as you filed https://github.com/rust-lang/rust/pull/101894
2022-09-26 17:17:07 +00:00
bors
e1d7dec558 Auto merge of #102051 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
Update bootstrap compiler to 1.65.0

This PR updates the bootstrap compiler to Rust 1.65.0, removing the various `cfg(bootstrap)`s.

r? `@Mark-Simulacrum`
2022-09-26 14:22:43 +00:00
b-naber
6118ee343f address review 2022-09-26 14:21:39 +02:00
bors
84946fe241 Auto merge of #102184 - chenyukang:fix-102087-add-binding-sugg, r=nagisa
Suggest Default::default() when binding isn't initialized

Fixes #102087
2022-09-26 11:41:58 +00:00
b-naber
456f4e8d22 don't duplicate late-bound region names in print of Binder 2022-09-26 13:10:55 +02:00
David Wood
f20c882b8b macros: support diagnostic derive on enums
Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-26 11:59:19 +01:00
Pietro Albini
3975d55d98
remove cfg(bootstrap) 2022-09-26 10:14:45 +02:00
Pietro Albini
d0305b3d00
replace stabilization placeholders 2022-09-26 10:13:44 +02:00
bors
21265dd0d2 Auto merge of #102224 - fee1-dead-contrib:const_trait_impl_specialization, r=oli-obk
Allow specializing on const trait bounds
2022-09-26 08:08:35 +00:00
bors
72f4923979 Auto merge of #102297 - fee1-dead-contrib:rollup-2np0cre, r=fee1-dead
Rollup of 5 pull requests

Successful merges:

 - #102143 (Recover from struct nested in struct)
 - #102178 (bootstrap: the backtrace feature is stable, no need to allow it any more)
 - #102197 (Stabilize const `BTree{Map,Set}::new`)
 - #102267 (Don't set RUSTC in the bootstrap build script)
 - #102270 (Remove benches from `rustc_middle`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-26 05:27:43 +00:00
fee1-dead
39c6bdc30d
Rollup merge of #102270 - Nilstrieb:delete-useless-benches, r=TaKO8Ki
Remove benches from `rustc_middle`

These benches benchmark rust langauge features and not the compiler, so they seem to be in the wrong place here. They also all take <1ns, making them pretty useless. Looking at their git history, they just seem to have been carried around for many, many years. This commit ends their journey.
2022-09-26 13:09:43 +08:00
fee1-dead
804c2c1ed9
Rollup merge of #102197 - Nilstrieb:const-new-🌲, r=Mark-Simulacrum
Stabilize const `BTree{Map,Set}::new`

The FCP was completed in #71835.

Since `len` and `is_empty` are not const stable yet, this also creates a new feature for them since they previously used the same `const_btree_new` feature.
2022-09-26 13:09:42 +08:00
fee1-dead
0adf293f87
Rollup merge of #102143 - Rageking8:fix-101540, r=TaKO8Ki
Recover from struct nested in struct

Fixes #101540

r? `@TaKO8Ki`

Not sure If I have done it right.
2022-09-26 13:09:41 +08:00
woppopo
e4b08ab241 Allow ~const bounds on non-const functions 2022-09-26 05:00:31 +00:00
bors
fe217c28ff Auto merge of #102292 - fee1-dead-contrib:rollup-61ptdkt, r=fee1-dead
Rollup of 4 pull requests

Successful merges:

 - #101851 (Clean up (sub)diagnostic derives)
 - #102244 (Only generate closure def id for async fns with body)
 - #102263 (Clarify Iterator::rposition code example)
 - #102280 (rustdoc: clean up `.out-of-band`/`.in-band` CSS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-26 02:45:13 +00:00
fee1-dead
c807277382
Rollup merge of #102244 - compiler-errors:issue-102219, r=cjgillot
Only generate closure def id for async fns with body

Fixes #102219
2022-09-26 09:27:37 +08:00
fee1-dead
1a93028bcc
Rollup merge of #101851 - Xiretza:diagnostic-derive-cleanups, r=davidtwco
Clean up (sub)diagnostic derives

The biggest chunk of this is unifying the parsing of subdiagnostic attributes (`#[error]`, `#[suggestion(...)]`, `#[label(...)]`, etc) between `Subdiagnostic` and `Diagnostic` type attributes as well as `Diagnostic` field attributes.

It also improves a number of proc macro diagnostics.

Waiting for #101558.
2022-09-26 09:27:36 +08:00
bors
3288d3a305 Auto merge of #101785 - jyn514:query-struct-fn-ptrs, r=cjgillot
Use function pointers instead of macro-unrolled loops in rustc_query_impl

By making these standalone functions, we
a) allow making them extensible in the future with a new `QueryStruct`
b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm

Helps with https://github.com/rust-lang/rust/issues/96524. Based on https://github.com/rust-lang/rust/pull/101173; only the last commit is relevant.

r? `@cjgillot`
2022-09-26 00:17:59 +00:00
yukang
672e3f4d77 fix #102087, Suggest Default::default() when binding isn't initialized 2022-09-26 07:56:26 +08:00
Michael Goulet
e99f6fee44 Only lower async fn body if it actually has a body 2022-09-25 23:03:15 +00:00
Michael Goulet
730ead8047 Only generate closure def id for async fns with body 2022-09-25 23:03:15 +00:00
Michael Goulet
4d0d688a3c Recover some items that expect braces and don't take semicolons 2022-09-25 22:34:25 +00:00
bors
ff40f2ec95 Auto merge of #101710 - jyn514:move-dep-kind-node, r=cjgillot
Move DepKindStruct from rustc_middle to rustc_query_system

Helps with https://github.com/rust-lang/rust/issues/96524. cc https://rust-lang.zulipchat.com/#narrow/stream/241847-t-compiler.2Fwg-incr-comp/topic/Moving.20.60DepKindStruct.60.20to.20rustc_query_system.20.2396524

r? `@cjgillot`
2022-09-25 21:37:10 +00:00
bors
f5193a9fcc Auto merge of #95474 - oli-obk:tait_ub, r=jackh726
Neither require nor imply lifetime bounds on opaque type for well formedness

The actual hidden type can live arbitrarily longer than any individual lifetime and arbitrarily shorter than all but one of the lifetimes.

fixes #86218
fixes #84305

This is a **breaking change** but it is a necessary soundness fix
2022-09-25 19:15:26 +00:00
Joshua Nelson
00cde6d4b9 Move the codegen_unit debug assert from rustc_query_system to query_impl
This allows removing a function from the `DepKind` trait.
2022-09-25 12:08:36 -05:00
Joshua Nelson
ccc8d000f2 Move some more code from rustc_middle to rustc_query_system 2022-09-25 12:08:36 -05:00
Joshua Nelson
f3f91bb514 Move functions on DepKindStruct from rustc_middle to rustc_query_system 2022-09-25 12:07:17 -05:00
Joshua Nelson
93a0fb190e Move DepKindStruct from rustc_middle to rustc_query_system 2022-09-25 11:56:23 -05:00
Nilstrieb
ddf7982741 Remove benches from rustc_middle
These benches benchmark rust langauge features and not the compiler,
so they seem to be in the wrong place here. They also all take <1ns,
making them pretty useless. Looking at their git history, they just
seem to have been carried around for many, many years. This commit
ends their journey.
2022-09-25 18:35:43 +02:00
Joshua Nelson
7a8369096c Use function pointers instead of macro-unrolled loops in rustc_query_impl
By making these standalone functions, we
a) allow making them extensible in the future with a new `QueryStruct`
b) greatly decrease the amount of code in each individual function, avoiding exponential blowup in llvm
2022-09-25 11:27:12 -05:00
bors
17e8752aca Auto merge of #102265 - fee1-dead-contrib:rollup-a7fccbg, r=fee1-dead
Rollup of 8 pull requests

Successful merges:

 - #98111 (Clarify `[T]::select_nth_unstable*` return values)
 - #101431 (Look at move place's type when suggesting mutable reborrow)
 - #101800 (Constify slice.split_at_mut(_unchecked))
 - #101997 (Remove support for legacy PM)
 - #102194 (Note the type when unable to drop values in compile time)
 - #102200 (Constify Default impl's for Arrays and Tuples.)
 - #102245 (Constify cmp_min_max_by.)
 - #102259 (Type-annotate and simplify documentation of Option::unwrap_or_default)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-25 14:28:04 +00:00
fee1-dead
b7d9de72ac
Rollup merge of #102194 - fee1-dead-contrib:improve-const-drop, r=oli-obk
Note the type when unable to drop values in compile time
2022-09-25 22:06:39 +08:00
fee1-dead
07467c5308
Rollup merge of #101997 - cuviper:drop-legacy-pm, r=nikic
Remove support for legacy PM

This removes support for optimizing with LLVM's legacy pass manager, as well as the unstable `-Znew-llvm-pass-manager` option. We have been defaulting to the new PM since LLVM 13 (except for s390x that waited for 14), and LLVM 15 removed support altogether. The only place we still use the legacy PM is for writing the output file, just like `llc` does.

cc #74705
r? ``@nikic``
2022-09-25 22:06:38 +08:00
fee1-dead
084029f39d
Rollup merge of #101431 - compiler-errors:move-place-ty-for-move-place-sugg, r=cjgillot
Look at move place's type when suggesting mutable reborrow

Not sure why we are looking at the use site's ty instead of the move site's ty in order to suggest reborrowing the move site, but it was suppressing a perfectly valid reborrow suggestion.

r? `@estebank` who i think touched this last in 520461f1fb, though that was quite a while ago so feel free to reassign.
2022-09-25 22:06:37 +08:00
bors
4652f5eb25 Auto merge of #100865 - compiler-errors:parent-substs-still, r=cjgillot
Don't drop parent substs when we have no generic parameters in `create_substs_for_ast_path`

This bug is being shadowed by an explicit check for `generics.params.is_empty()` in the only parent caller that could trigger it (`create_substs_for_associated_item`). I triggered it on another branch where I'm messing around with astconv stuff.

Also, the second commit simplifies `create_substs_for_associated_item`. Removing that explicit check I mentioned above^ and also the special case call to `Astconv::prohibit_generics` causes the UI test `src/test/ui/structs/struct-path-associated-type.stderr` to change, but I think that it's clearer now. The suggestion to remove the generics is actually useful.
2022-09-25 12:00:37 +00:00
Camille GILLOT
73c52bc4dc Fix scoping for let-else. 2022-09-25 11:30:49 +02:00
Matthias Krüger
11b4510202
Rollup merge of #102161 - compiler-errors:issue-102138, r=tmandry
Resolve async fn signature even without body (e.g., in trait)

Fixes #102138

This "bail if no body" behavior was introduced in #69539 to fix #69401, but that ICE does not reproduce any more. The error message changes a bit, but that's all, and I don't think it's a particularly diagnostic bad regression.
2022-09-25 09:32:08 +02:00
Matthias Krüger
16de1fddee
Rollup merge of #102016 - lcnr:given-OutlivesEnvironment, r=jackh726
implied_bounds: deal with inference vars

fixes #101951

while computing implied bounds for `<<T as ConstructionFirm>::Builder as BuilderFn<'_>>::Output` normalization replaces a projection with an inference var (adding a `Projection` obligation). Until we prove that obligation, this inference var remains unknown, which caused us to miss an implied bound necessary to prove that the unnormalized projection from the trait method signature is wf.

r? types
2022-09-25 09:32:07 +02:00
bors
d0ece44cfa Auto merge of #102040 - TaKO8Ki:separate-definitions-and-hir-owners, r=cjgillot
Separate definitions and HIR owners in the type system

Fixes #83158

r? `@cjgillot`
2022-09-24 22:42:07 +00:00
Deadbeef
2ce1cd511f Note the type when unable to drop values in compile time 2022-09-24 20:32:51 +00:00
Michael Goulet
3d7e9a7b27 Only record extra lifetime params for async trait fn with no body 2022-09-24 19:26:54 +00:00
Michael Goulet
59c4a92baf Resolve async fn signature even without body (in trait) 2022-09-24 19:26:54 +00:00
Takayuki Maeda
8fe936099a separate definitions and HIR owners
fix a ui test

use `into`

fix clippy ui test

fix a run-make-fulldeps test

implement `IntoQueryParam<DefId>` for `OwnerId`

use `OwnerId` for more queries

change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-24 23:21:19 +09:00