1
Fork 0
rust/compiler/rustc_hir_analysis/src
Michael Goulet 4ec548afbe
Rollup merge of #118161 - compiler-errors:coroutine-obligation-opaques, r=lcnr
Allow defining opaques in `check_coroutine_obligations`

In the new trait solver, when an obligation stalls on an unresolved coroutine witness, we will stash away the *root* obligation, even if the stalled obligation is only a distant descendent of the root obligation, since the new solver is purely recursive.

This means that we may need to reprocess alias-relate obligations (and others) which may define opaque types in the new solver. Currently, we use the coroutine's def id as the defining anchor in `check_coroutine_obligations`, which will allow defining no opaque types, resulting in errors like:

```
error[E0271]: type mismatch resolving `{coroutine@<source>:6:5: 6:17} <: impl Clone`
 --> <source>:6:5
  |
6 | /     move |_: ()| {
7 | |         let () = yield ();
8 | |     }
  | |_____^ types differ
```

So this PR fixes the defining anchor and does the same trick as `check_opaque_well_formed`, where we manually compare opaques that were defined against their hidden types to make sure they weren't defined differently when processing these stalled coroutine obligations.

r? `@lcnr` cc `@cjgillot`
2023-11-22 09:28:52 -08:00
..
astconv Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
check Allow defining opaques in check_coroutine_obligations 2023-11-22 03:44:13 +00:00
coherence Replace no_ord_impl with orderable. 2023-11-22 18:38:17 +11:00
collect Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
impl_wf_check Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
outlives Make regionck care about placeholders in outlives components 2023-11-19 19:12:20 +00:00
structured_errors Rollup merge of #116553 - gurry:116464-assoc-type-invalid-suggestion, r=compiler-errors 2023-10-25 23:37:09 +02:00
variance finish RegionKind rename 2023-11-14 13:13:27 +00:00
autoderef.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
bounds.rs Don't compare host param by name 2023-10-18 02:38:54 +00:00
check_unused.rs inline format!() args from rustc_codegen_llvm to the end (4) 2023-07-25 23:20:28 +02:00
collect.rs Fix clippy::needless_borrow in the compiler 2023-11-21 20:13:40 +01:00
constrained_generic_params.rs finish RegionKind rename 2023-11-14 13:13:27 +00:00
errors.rs Improve some diagnostics around ?Trait bounds 2023-10-30 17:47:07 +00:00
hir_wf_check.rs replace unnecessary folder impls with fold_region 2023-11-17 08:58:18 +00:00
impl_wf_check.rs Use {Local}ModDefId in many queries 2023-08-14 07:22:48 +00:00
lib.rs Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
structured_errors.rs