about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-02-28 16:04:54 +0100
committerGitHub <noreply@github.com>2024-02-28 16:04:54 +0100
commit1b08d1a92cd8586768338ea9dc776054e747861a (patch)
tree428024ac4a2b815e6632a75578f77df1109f87fc /compiler/rustc_parse/src/parser/expr.rs
parentca69a1ff75a8f72df0a9fcafda3b756f9ca9c1b5 (diff)
parentcc584ba24527f16b3c88f46959fedcfc716d5503 (diff)
downloadrust-1b08d1a92cd8586768338ea9dc776054e747861a.tar.gz
rust-1b08d1a92cd8586768338ea9dc776054e747861a.zip
Rollup merge of #121702 - compiler-errors:coerce-alias-relate, r=lcnr
Process alias-relate obligations in CoerceUnsized loop

After #119106, we now emit `AliasRelate` goals when relating `?0` and `Alias<T, ..>` in the new solver. In the ad-hoc `CoerceUnsized` selection loop, we now may have `AliasRelate` goals which must be processed to constrain type variables which are mentioned in other goals.

---

For example, in the included test, we try to coerce `&<ManuallyDrop<T> as Deref>::Target` to `&dyn Foo`. This requires proving:
* 1 `&<ManuallyDrop<T> as Deref>::Target: CoerceUnsized<&dyn Foo>`
    * 2 `<ManuallyDrop<T> as Deref>::Target alias-relate ?0`
    * 3 `?0: Unsize<dyn Foo>`
        * 4 `?0: Foo`
        * 5 `?0: Sized`

If we don't process goal (2.) before processing goal (3.), then we hit ambiguity since `?0` is never constrained, and therefore we bail out, refusing to coerce the types. After processing (2.), we know `?0 := T`, and the rest of the goals can be processed normally.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
0 files changed, 0 insertions, 0 deletions