Commit Graph

20803 Commits

Author SHA1 Message Date
Yiming Lei
d1478a5600 delay E0512 as a bug by checking the references_error
fix #106695
2023-01-17 09:20:15 -08:00
bors
1bc3683b32 Auto merge of #106773 - Nilstrieb:rollup-sq73pyg, r=Nilstrieb
Rollup of 6 pull requests

Successful merges:

 - #105806 (Support eager subdiagnostics again)
 - #106322 (Handle inference variables in `CollectAllMismatches` correctly)
 - #106579 (Suggest making private tuple struct field public)
 - #106714 (remove unreachable error code `E0490`)
 - #106751 (Fix rendering 'const' in header for intrinsics)
 - #106761 (Add `WaffleLapkin` to compiler reviewers)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 17:11:03 +00:00
nils
c61f29ca52
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
remove unreachable error code `E0490`

AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker.

cc ``@GuillaumeGomez`` #61137
2023-01-12 15:44:52 +01:00
nils
25fd633828
Rollup merge of #106579 - estebank:issue-52144, r=Nilstrieb
Suggest making private tuple struct field public

Fix #52144.
2023-01-12 15:44:51 +01:00
nils
35cf81d707
Rollup merge of #106322 - compiler-errors:CollectAllMismatches-infer-vars, r=oli-obk
Handle inference variables in `CollectAllMismatches` correctly

1. Fix #106240
2. Treat int/float type variables correctly (see `src/test/ui/iterators/invalid-iterator-chain-with-int-infer.rs`), so we can point out things like "`Iterator::Item` changed to `{integer}` here"
2023-01-12 15:44:51 +01:00
nils
6bf57b8110
Rollup merge of #105806 - mejrs:eager2, r=davidtwco
Support eager subdiagnostics again

See https://github.com/rust-lang/rust/pull/104941#discussion_r1051135746

I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.
2023-01-12 15:44:50 +01:00
bors
222d1ff68d Auto merge of #105603 - oli-obk:non_repeatable_queries, r=petrochenkov
Harden the pre-tyctxt query system against accidental recomputation

While the current compiler has no issues where we `take` and then compute the query again, in https://github.com/rust-lang/rust/pull/105462 I accidentally introduced such a case.

I also took the opportunity to remove `peek_mut`, which is only ever used for `global_tcx` to then invoke `enter`. I added an `enter` method directly on the query.
2023-01-12 13:59:30 +00:00
bors
606c390725 Auto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub})
 - #103800 (Stabilize `::{core,std}::pin::pin!`)
 - #106097 (Migrate mir_build diagnostics 2 of 3)
 - #106170 (Move autoderef to `rustc_hir_analysis`)
 - #106323 (Stabilize f16c_target_feature)
 - #106360 (Tweak E0277 `&`-removal suggestions)
 - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch)
 - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 10:46:19 +00:00
Oli Scherer
58782a8842 Harden the pre-tyctxt query system against accidental recomputation 2023-01-12 09:26:28 +00:00
Michael Goulet
9ec36f5668
Rollup merge of #106739 - WaffleLapkin:astconv, r=estebank
Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`

This removes the need for <>><><><<>> dances and makes the code a bit nicer.

Not sure if `astconv` is the best name though, maybe someone has a better idea?
2023-01-11 22:25:50 -08:00
Michael Goulet
d7113948d3
Rollup merge of #106524 - compiler-errors:constructor-note, r=cjgillot
Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch

Fixes #106516
2023-01-11 22:25:49 -08:00
Michael Goulet
54f6fea818
Rollup merge of #106360 - estebank:remove-borrow-suggestion, r=compiler-errors
Tweak E0277 `&`-removal suggestions

Fix #64068, fix #84837.
2023-01-11 22:25:49 -08:00
Michael Goulet
244b90edee
Rollup merge of #106323 - starkat99:stabilize-f16c_target_feature, r=petrochenkov
Stabilize f16c_target_feature

Resolves https://github.com/rust-lang/stdarch/issues/1234

Library PR for stabilizing corresponding intrinsics: https://github.com/rust-lang/stdarch/pull/1366

See also #44839 tracking issue for target_feature
2023-01-11 22:25:48 -08:00
Michael Goulet
9928b14772
Rollup merge of #106170 - compiler-errors:autoderef-to-analysis, r=lcnr
Move autoderef to `rustc_hir_analysis`

Not sure if this is a change we actually want, but autoderef really is only (functionally) used by `rustc_hir_analysis` and `rustc_hir_typeck`, so it probably should live there.

Instead, implement a separate autoderef helper in `TypeErrCtxt` for the one use-case that  goes against the ordering of the crate graph..
2023-01-11 22:25:48 -08:00
Michael Goulet
83d3b76ac2
Rollup merge of #106097 - mejrs:mir_build2, r=oli-obk
Migrate mir_build diagnostics 2 of 3

The first three commits are fairly boring, however I've made some changes to the output of the match checking diagnostics.
2023-01-11 22:25:47 -08:00
Matthias Krüger
e8ef83e4c0
Rollup merge of #106748 - clubby789:on-unimplemented-fmt-verify, r=compiler-errors
Clean up `OnUnimplementedFormatString::verify`

Lift the always-allowed symbols to a static array and replace a `match iter().find(...)` with `iter().any(...)`
2023-01-12 06:52:39 +01:00
Matthias Krüger
a90742ac98
Rollup merge of #106732 - durin42:dmitrig-arrayref-ctor, r=nikic
rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.

LLVM upstream has deprecated llvm::makeArrayRef and will remove it.
2023-01-12 06:52:38 +01:00
Matthias Krüger
8a13157c16
Rollup merge of #106702 - estebank:trait-bounds, r=compiler-errors
Conserve cause of `ImplDerivedObligation` in E0599

CC #86377.
2023-01-12 06:52:38 +01:00
Matthias Krüger
890bc3ca90
Rollup merge of #106596 - estebank:verbose-e0271, r=compiler-errors
Hide more of long types in E0271

Fix #40186.
2023-01-12 06:52:36 +01:00
Matthias Krüger
e664cb2154
Rollup merge of #106532 - compiler-errors:dyn-star-to-dyn, r=jackh726
Allow codegen to unsize `dyn*` to `dyn`

`dyn* Trait` is just another type that implements `Trait`, so we should be able to unsize `&dyn* Trait` into `&dyn Trait` perfectly fine, same for `Box` and other unsizeable types.

Fixes #106488
2023-01-12 06:52:35 +01:00
Matthias Krüger
9b538e8e62
Rollup merge of #106309 - compiler-errors:prefer-non-err-candidates, r=oli-obk
Prefer non-`[type error]` candidates during selection

Fixes #102130
Fixes #106351

r? types

note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during `match_impl`, I think.
2023-01-12 06:52:34 +01:00
Matthias Krüger
a8bd0c04b4
Rollup merge of #106167 - yanchen4791:issue-105544-fix, r=oli-obk
Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311

Fixes #105544

The problems: The suggestion given for E0311 has invalid syntax when the synthetic type parameter is used for Trait type in function declaration:
```rust
fn foo(d: impl Sized) -> impl Sized
```
instead of explicitly specified like the following:
```rust
fn foo<T: Sized>(d: T) -> impl Sized
```
In addition to the syntax error, the suggestions given for E0311 are not complete when multiple elided lifetimes are involved in lifetime bounds, not all involved parameters are given the named lifetime in the suggestions. For the following test case:
```
fn foo(d: impl Sized, p: &mut ()) -> impl Sized + '_ {
    (d, p)
}
```
a good suggestion should add the lifetime 'a to both d and p, instead of d only:
```
fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ {
    (d, p)
}
```

The Solution: Fix the syntax problem in the suggestions when synthetic type parameter is used, and also add lifetimes for all involved parameters.
2023-01-12 06:52:34 +01:00
bors
d4203eda5f Auto merge of #106537 - fmease:recover-where-clause-before-tuple-struct-body, r=estebank
Recover from where clauses placed before tuple struct bodies

Open to any suggestions regarding the phrasing of the diagnostic.

Fixes #100790.
`@rustbot` label A-diagnostics
r? diagnostics
2023-01-12 02:16:16 +00:00
Ezra Shaw
02005e9f22
remove unreachable error code E0490 2023-01-12 14:15:21 +13:00
clubby789
b78a571ce1 Clean up OnUnimplementedFormatString::verify 2023-01-11 22:54:46 +00:00
yanchen4791
621d412241
Fix invalid syntax in impl Trait parameter type suggestions for E0311 2023-01-11 14:49:55 -08:00
mejrs
372ac9c1a2
Translate Overlap eagerly 2023-01-11 14:40:13 -08:00
mejrs
3d260fa63c
Some cleanup, oops 2023-01-11 14:40:10 -08:00
mejrs
8476c517c0
Don't recommend if let if let else works 2023-01-11 14:40:07 -08:00
mejrs
31c20210b9
Migrate pattern matching 2023-01-11 14:40:02 -08:00
mejrs
ef33072890
Migrate usefulness.rs 2023-01-11 14:39:59 -08:00
mejrs
5d2b9a9ed0
Migrate deconstruct_pat.rs 2023-01-11 14:39:49 -08:00
mejrs
519b1abd19
Translate const_to_pat.rs 2023-01-11 14:39:27 -08:00
mejrs
7aff210ead
Support eager subdiagnostics again 2023-01-11 14:20:34 -08:00
Esteban Küber
f1ffe823cf Hide more of long types in E0271
Fix #40186.
2023-01-11 21:40:39 +00:00
Esteban Küber
8b8cce16bf Use the root trait predicate to determine whether to remove references
Fix #84837.
2023-01-11 21:39:07 +00:00
Esteban Küber
bb7211702e fix rebase 2023-01-11 21:38:56 +00:00
Esteban Küber
ce83be4af8 Account for type params 2023-01-11 21:38:56 +00:00
Esteban Küber
2024aa48b4 Make &-removal suggestion verbose 2023-01-11 21:38:54 +00:00
Esteban Küber
41e66d9025 review comments: Tweak output
* Account for `struct S(pub(super)Ty);` in suggestion
* Suggest changing field visibility in E0603 too
2023-01-11 21:36:02 +00:00
Esteban Küber
eb835093a3 review comment 2023-01-11 21:35:42 +00:00
Esteban Küber
ad13d9fbbe Suggest making private tuple struct field public
Fix #52144.
2023-01-11 21:35:42 +00:00
Michael Goulet
c8334ce60c Move autoderef to rustc_hir_analysis 2023-01-11 20:12:57 +00:00
Matthias Krüger
dce5e29edc
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
Fix some typos in code comments.
2023-01-11 21:08:09 +01:00
Matthias Krüger
865d83e87a
Rollup merge of #106705 - compiler-errors:new-solver-err-properly, r=lcnr
Report fulfillment errors in new trait solver

Causes fewer ICEs when testing the new solver 😄
2023-01-11 21:08:09 +01:00
Matthias Krüger
90f9c681d4
Rollup merge of #106703 - compiler-errors:impl-derived-span, r=estebank
Note predicate span on `ImplDerivedObligation`

Seems obvious to point out the where-clause that introduces the `ImplDerivedObligation` :)

r? `@estebank`
2023-01-11 21:08:08 +01:00
Matthias Krüger
88765b0f59
Rollup merge of #106622 - estebank:issue-68972, r=davidtwco
Detect out of bounds range pattern value

Fix #68972.
2023-01-11 21:08:07 +01:00
Matthias Krüger
7ee3fd2edc
Rollup merge of #106620 - estebank:issue-82051, r=davidtwco
Detect struct literal needing parentheses

Fix #82051.
2023-01-11 21:08:07 +01:00
Michael Goulet
83fbc71d02 Filter impl and where-clause candidates that reference errors 2023-01-11 20:03:29 +00:00
Michael Goulet
4e30ad8d60 Reuse ErrorGuaranteed during relation 2023-01-11 20:02:43 +00:00