Commit Graph

158 Commits

Author SHA1 Message Date
bors
1d6f05fd37 Auto merge of #116439 - compiler-errors:on-unimplemented, r=davidtwco
Pretty print `Fn` traits in `rustc_on_unimplemented`

I don't think that users really ever should need to think about `Fn*` traits' tupled args for a simple trait error.

r? diagnostics
2023-11-03 06:08:03 +00:00
Michael Goulet
c83f642f12 Pretty print Fn traits in rustc_on_unimplemented 2023-11-02 20:57:05 +00:00
Michael Goulet
bb74d7e97d Use the normalizing param-env always in check_type_bounds 2023-11-02 20:47:05 +00:00
Georg Semmler
160b1793b2
Allows #[diagnostic::on_unimplemented] attributes to have multiple
notes

This commit extends the `#[diagnostic::on_unimplemented]` (and
`#[rustc_on_unimplemented]`) attributes to allow multiple `note`
options. This enables emitting multiple notes for custom error messages.
For now I've opted to not change any of the existing usages of
`#[rustc_on_unimplemented]` and just updated the relevant compile tests.
2023-10-27 12:42:42 +02:00
Oli Scherer
beaf46f7e5 Work around the fact that check_mod_type_wf may spuriously return ErrorGuaranteed, even if that error is only emitted by check_modwitem_types 2023-10-25 12:04:54 +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
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Oli Scherer
60956837cf s/Generator/Coroutine/ 2023-10-20 21:10:38 +00:00
Esteban Küber
bd8b46800d Tweak wording of type errors involving type params
Fix #78206.
2023-10-18 23:53:18 +00:00
yukang
25d38c48c3 Suggest adding return if the type of unused semi return value can coerce to the fn return type 2023-10-15 22:57:03 +08:00
Michael Goulet
59315b8a63 Stabilize AFIT and RPITIT 2023-10-13 21:01:36 +00:00
Matthias Krüger
3712ea82f3
Rollup merge of #116436 - compiler-errors:structurally-normalize-for-closure, r=lcnr
Structurally normalize for closure

Fixes some signature deduction problems in the new trait solver (and in the case of async, an ICE).

r? lcnr
2023-10-11 20:08:21 +02:00
Michael Goulet
592163fb71 Extend impl's def_span to include where clauses 2023-10-09 11:47:02 +00:00
Michael Goulet
dfbb1bfc89 Also closures 2023-10-05 00:05:45 +00:00
Michael Goulet
966f27977a Structurally normalize async fn return type in deduce_future_output_from_obligations 2023-10-05 00:05:20 +00:00
Esteban Küber
91b9ffeab0 Reorder fullfillment errors to keep more interesting ones first
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed`
and coercion errors to the end of the list. The pre-existing
deduplication logic eliminates redundant errors better that way, keeping
the resulting output with fewer errors than before, while also having
more detail.
2023-10-04 02:04:14 +00:00
bors
60bb5192d1 Auto merge of #115843 - lcnr:bb-provisional-cache, r=compiler-errors
new solver: remove provisional cache

The provisional cache is a performance optimization if there are large, interleaving cycles. Such cycles generally do not exist. It is incredibly complex and unsound in all trait solvers which have one: the old solver, chalk, and the new solver ([link](https://github.com/rust-lang/rust/blob/master/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs)).

Given the assumption that it is not perf-critical and also incredibly complex, remove it from the new solver, only checking whether a goal is on the stack. While writing this, I uncovered two additional soundness bugs, see the inline comments for them.

r? `@compiler-errors`
2023-09-29 02:09:40 +00:00
Camille GILLOT
211d2ed07b Bless tests. 2023-09-23 13:47:30 +00:00
Ralf Jung
c4ec12f4b7 adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +02:00
lcnr
8eade3aa71 update tests 2023-09-21 08:17:58 +02:00
lcnr
e8b8ddd17e remove provisional cache 2023-09-18 17:01:29 +02:00
Michael Goulet
280f058560 Canonicalize effect vars in new solver 2023-09-15 05:11:16 +00:00
Michael Goulet
30e6cea0ae Point out if a local trait has no implementations 2023-09-10 21:20:36 +00:00
Michael Goulet
8c667febbd Don't ICE on associated type projection without feature gate 2023-09-03 19:43:58 +00:00
Rémy Rakic
325b585259 add non-regression test for issue 115351 2023-08-29 19:03:08 +00:00
David Tolnay
823bacb6e3
Revert "Suggest using Arc on !Send/!Sync types"
This reverts commit 9de1a472b6.
2023-08-28 03:16:48 -07:00
Esteban Küber
b6494a7bb4 More accurately point at arguments 2023-08-26 19:25:46 +00:00
Esteban Küber
120c24dab5 Point at appropriate type parameter in more trait bound errors 2023-08-26 01:07:05 +00:00
lcnr
ee04744e64 change to known bug 2023-08-18 23:59:49 +02:00
lcnr
11716830ac instantiate response: no unnecessary new universe
this previously was a off-by-one error.
2023-08-18 23:55:28 +02:00
lcnr
9eeaf1fd13 normalize in trait_ref_is_knowable in new solver 2023-08-12 20:37:53 +02:00
lcnr
02529d2cbe add and move trait solver cycle tests 2023-08-10 14:18:31 +02:00
lcnr
d558353f28 make the provisional cache slightly less broken 2023-08-10 12:35:34 +02:00
Esteban Kuber
9de1a472b6 Suggest using Arc on !Send/!Sync types 2023-08-09 14:04:10 +00:00
lcnr
95d1f6bab5 add test from chalk#788 for new solver 2023-08-08 18:07:38 +02:00
Matthias Krüger
418b91a3d7
Rollup merge of #114594 - compiler-errors:new-solver-resolve-aliases, r=lcnr
Structurally normalize weak and inherent in new solver

It seems pretty obvious to me that we should be normalizing weak and inherent aliases too, since they can always be normalized. This PR still leaves open the question of what to do with opaques, though 💀

**Also**, we need to structurally resolve the target of a coercion, for the UI test to work.

r? `@lcnr`
2023-08-08 03:30:56 +02:00
Michael Goulet
ba4a2f7cb7 Resolve target type of coercion 2023-08-07 19:06:18 +00:00
Matthias Krüger
2a643b2dc0
Rollup merge of #114196 - compiler-errors:bubble-pls, r=lcnr
Bubble up nested goals from equation in `predicates_for_object_candidate`

This used to be needed for https://github.com/rust-lang/rust/pull/114036#discussion_r1273987510, but since it's no longer, I'm opening this as a separate PR. This also fixes one ICEing UI test: (`tests/ui/unboxed-closures/issue-53448.rs`)

r? `@lcnr`
2023-08-07 16:47:54 +02:00
lcnr
b1d9cb9a2a add tests 2023-08-03 15:12:44 +02:00
Michael Goulet
d21a335e8f Don't select infer -> dyn Trait 2023-08-01 23:12:03 +00:00
Michael Goulet
57407a3555 Bubble up nested goals from equation in predicates_for_object_candidate 2023-07-29 05:55:03 +00:00
Michael Goulet
1ffc6ca9a5 Consider a goal as NOT changed if its response is identity modulo regions 2023-07-27 04:00:49 +00:00
Michael Goulet
24eefd08e2 Make sure to detect trait upcasting coercion even after normalization 2023-07-25 15:15:25 +00:00
Michael Goulet
7e66c0b7ed Normalize the RHS of an unsize goal 2023-07-25 15:15:25 +00:00
lcnr
2062f2ca82 review 2023-07-20 12:01:34 +02:00
lcnr
2d99f40ec5 assembly: only consider blanket impls once 2023-07-20 11:05:52 +02:00
Dylan DPC
c2257b9412
Rollup merge of #113444 - lcnr:alias-bound-test, r=compiler-errors
add tests for alias bound preference

cc https://github.com/rust-lang/trait-system-refactor-initiative/issues/45

r? ``@compiler-errors``
2023-07-19 22:37:06 +05:30
Michael Goulet
c9ce51b5c7 Check GAT, IAT, and weak type where clauses during projection 2023-07-16 21:14:38 +00:00
Matthias Krüger
da18cf8572
Rollup merge of #113625 - compiler-errors:structurally-norm-in-selection, r=lcnr
Structurally normalize in selection

We need to do this because of the fact that we're checking the `Ty::kind` on a type during selection, but goals passed into select are not necessarily normalized.

Right now, we're (kinda) unnecessarily normalizing the RHS of a trait upcasting goal, which is broken for different reasons (#113393). But I'm waiting for this PR to land before discussing that one.

r? `@lcnr`
2023-07-15 19:42:51 +02:00
Michael Goulet
7fb27e4717 Structurally normalize in selection 2023-07-14 18:40:18 +00:00