about summary refs log tree commit diff
path: root/tests/ui/dyn-compatibility/multiple-supers-should-work.rs
blob: 6f381da9a22004de5e25d62e78bece57c8976812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//@ check-pass

// We previously incorrectly deduplicated the list of projection bounds
// of trait objects, causing us to incorrectly reject this code, cc #136458.

trait Sup<T> {
    type Assoc;
}

impl<T> Sup<T> for () {
    type Assoc = T;
}

trait Trait<A, B>: Sup<A, Assoc = A> + Sup<B, Assoc = B> {}

impl<T, U> Trait<T, U> for () {}

fn main() {
    let x: &dyn Trait<(), _> = &();
    let y: &dyn Trait<_, ()> = x;
}