about summary refs log tree commit diff
path: root/tests/ui/impl-trait/non-defining-uses/use-item-bound.rs
blob: 36dcbacbe6fdf064e31f9befa372cf7cb5e4033e (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
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@ check-pass
#![allow(unconditional_recursion)]
// Regression test for trait-system-refactor-initiative#182.

trait Id {
    type This;
}
impl<T> Id for Vec<T> {
    type This = Vec<T>;
}
fn to_assoc<T: Id>(x: T) -> <T as Id>::This {
    todo!()
}

fn mirror<T>(x: Vec<T>) -> impl Id<This = Vec<T>> {
    let x = to_assoc(mirror(x));
    // `?x` equals `<opaque::<T> as Id>::This`. We need to eagerly infer the
    // type of `?x` to prevent this method call from resulting in an error.
    x.len();
    x
}
fn main() {}