summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/rpit/equal-lifetime-params-ok.rs
blob: 6207381c7452cad08724d48d4368fc07306949e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// check-pass

// related to #113916, check that using RPITs in functions with lifetime params
// which are constrained to be equal compiles.

trait Trait<'a, 'b> {}
impl Trait<'_, '_> for () {}
fn pass<'a: 'b, 'b: 'a>() -> impl Trait<'a, 'b> {
    (|| {})()
}

struct Foo<'a>(&'a ());
impl<'a> Foo<'a> {
    fn bar<'b: 'a>(&'b self) -> impl Trait<'a, 'b> {
        let _: &'a &'b &'a ();
    }
}

fn main() {}