]> git.proxmox.com Git - rustc.git/blob - tests/ui/impl-trait/associated-impl-trait-type-generic-trait.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / impl-trait / associated-impl-trait-type-generic-trait.rs
1 #![feature(type_alias_impl_trait)]
2 // build-pass (FIXME(62277): could be check-pass?)
3
4 trait Bar {}
5 struct Dummy<U>(U);
6 impl<V> Bar for Dummy<V> {}
7
8 trait Foo<T> {
9 type Assoc: Bar;
10 fn foo(t: T) -> Self::Assoc;
11 }
12
13 impl<W> Foo<W> for i32 {
14 type Assoc = impl Bar;
15 fn foo(w: W) -> Self::Assoc {
16 Dummy(w)
17 }
18 }
19
20 struct NonGeneric;
21 impl Bar for NonGeneric {}
22
23 impl<W> Foo<W> for u32 {
24 type Assoc = impl Bar;
25 fn foo(_: W) -> Self::Assoc {
26 NonGeneric
27 }
28 }
29
30 fn main() {}