about summary refs log tree commit diff
path: root/tests/ui/traits/next-solver/supertrait-alias-4.rs
blob: 919a768fcf28172022e735a05906cf43a004875f (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
//@ compile-flags: -Znext-solver
//@ check-pass

// Exercises the ambiguity that comes from replacing the associated types within the bounds
// that are required for a `impl Trait for dyn Trait` built-in object impl to hold.

trait Sup<T> {
    type Assoc;
}

trait Foo<A, B>: Sup<A, Assoc = A> + Sup<B, Assoc = B> {
    type Other: Bar<<Self as Sup<A>>::Assoc>;
}

trait Bar<T> {}
impl Bar<i32> for () {}

fn foo<A, B>(x: &(impl Foo<A, B> + ?Sized)) {}

fn main() {
    let x: &dyn Foo<_, _, Other = ()> = todo!();
    foo(x);
    let y: &dyn Foo<i32, u32, Other = ()> = x;
}