diff options
Diffstat (limited to 'tests/ui/unsized/issue-75899-but-gats.rs')
-rw-r--r-- | tests/ui/unsized/issue-75899-but-gats.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/unsized/issue-75899-but-gats.rs b/tests/ui/unsized/issue-75899-but-gats.rs new file mode 100644 index 000000000..5716817f4 --- /dev/null +++ b/tests/ui/unsized/issue-75899-but-gats.rs @@ -0,0 +1,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; +} |