about summary refs log tree commit diff
path: root/tests/ui/unsized/issue-75899-but-gats.rs
blob: 733a150a941d60f8ccf228324969b19fab95ef17 (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;
}