about summary refs log tree commit diff
path: root/tests/ui/unsized/unsize-coerce-multiple-adt-params.rs
blob: 9028208812dcdb2a9244436136ce7bb7ffc86935 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//@ check-pass

struct Foo<T, U>
where
    (T, U): Trait,
{
    f: <(T, U) as Trait>::Assoc,
}

trait Trait {
    type Assoc: ?Sized;
}

struct Count<const N: usize>;

impl<const N: usize> Trait for (i32, Count<N>) {
    type Assoc = [(); N];
}

impl<'a> Trait for (u32, ()) {
    type Assoc = [()];
}

// Test that we can unsize several trait params in creative ways.
fn unsize<const N: usize>(x: &Foo<i32, Count<N>>) -> &Foo<u32, ()> {
    x
}

fn main() {}