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

// Regression test for <https://github.com/rust-lang/trait-system-refactor-initiative/issues/171>.
// Tests that we don't try to replace `<T as Other>::Assoc` when replacing projections in the
// required bounds for `dyn Foo`, b/c `T` is not relevant to the dyn type, which we were
// encountering when walking through the elaborated supertraits of `dyn Foo`.

trait Other<X> {}

trait Foo<T: Foo<T>>: Other<<T as Foo<T>>::Assoc> {
    type Assoc;
}

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

impl<T: ?Sized> Other<()> for T {}

fn is_foo<T: Foo<()> + ?Sized>() {}

fn main() {
    is_foo::<dyn Foo<(), Assoc = ()>>();
}