summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unsized/issue-75899-but-gats.rs
blob: 5716817f43ded8987731ec97922f5ec24e426035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// check-pass

use std::fmt::Debug;
use std::marker::PhantomData;

trait Foo {
    type Gat<'a>: ?Sized where Self: 'a;
}

struct Bar<'a, T: Foo + 'a>(T::Gat<'a>);

struct Baz<T: ?Sized>(PhantomData<T>);

impl<T: ?Sized> Foo for Baz<T> {
    type Gat<'a> = T where Self: 'a;
}

fn main() {
    let x = Bar::<'_, Baz<()>>(());
    let y: &Bar<'_, Baz<dyn Debug>> = &x;
}