about summary refs log tree commit diff
path: root/compiler/rustc_mir_dataflow/src/move_paths/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-29 21:24:51 +0000
committerbors <bors@rust-lang.org>2023-06-29 21:24:51 +0000
commit330727467b8fdf2c43b95095a0efae7012c4f83b (patch)
treef2840a28b3af4641636206bbe3b199f4a52a5b9b /compiler/rustc_mir_dataflow/src/move_paths/mod.rs
parentb23a5add09283360bb3b8eaa4292ce3366e62615 (diff)
parent6f4a51e80e60105f0109db7bc89d181ba14747f2 (diff)
downloadrust-330727467b8fdf2c43b95095a0efae7012c4f83b.tar.gz
rust-330727467b8fdf2c43b95095a0efae7012c4f83b.zip
Auto merge of #112682 - spastorino:new-rpitit-21, r=compiler-errors
Add bidirectional where clauses on RPITIT synthesized GATs

Given the following:

```rust
struct MyStruct<'a, T>(&'a T);

trait MyTrait<'a, T> {
    fn my_fn<'b, 'c, 'd, V>(item: &'c String) -> impl Sized + 'a + 'b + 'c where V: 'b, V: 'd;
}

impl<'a, T> MyTrait<'a, T> for MyStruct<'a, T> {
    fn my_fn<'b, 'c, 'd, V>(_: &'c String) -> impl Sized + 'a + 'b + 'c
    where
        V: 'b,
        V: 'd,
    {
        unimplemented!();
    }
}
```

We need the desugaring to be:

```rust
trait MyTrait<'a, T> {
    type MyFn<'bf, 'df, Vf, 'a2, 'b2, 'c2>: Sized + 'a2 + 'b2 + 'c2 where Vf: 'b2, 'a2: 'a, 'a: 'a2, 'b2: 'bf, 'bf: 'b2;

    fn my_fn<'b, 'c, 'd, V>(item: &'c String) -> MyStruct<'a>::MyFn<'b, 'd, V, 'a, 'b, 'c> where V: 'b, V: 'd {
        type opaque<'a3, 'b3, 'c3>;
    };
}

impl<'a, T> MyIter<'a, T> for MyStruct<'a, T> {
    type MyFn<'bf, 'df, Vf, 'a2, 'b2, 'c2> = impl Sized + 'a2 + 'b2 + 'c2 where Vf: b2, 'a2: 'a, 'a: 'a2, 'b2: 'bf, 'bf: 'b2;

    fn my_fn<'b, 'c, 'd, V>(_: &'c String) -> MyStruct<'a>::MyFn<'a, 'b, 'c, V> where V: 'b, V: 'd {
        type opaque<'a3, 'b3, 'c3>;
        unimplemented!();
    }
}
```

This PR adds the where clauses for the `MyFn` generated GATs.

This is a draft with a very ugly solution so we can make comments over concrete code.

r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/move_paths/mod.rs')
0 files changed, 0 insertions, 0 deletions