about summary refs log tree commit diff
path: root/tests/ui/borrowck/implied-bound-from-impl-header.rs
blob: 326a62b22f05547a4bb2bfbd25fd242dd2d419e3 (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
//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

// Make sure that we can normalize `<T as Ref<'a>>::Assoc` to `&'a T` and get
// its implied bounds in impl header.

trait Ref<'a> {
    type Assoc;
}
impl<'a, T> Ref<'a> for T where T: 'a {
    type Assoc = &'a T;
}

fn outlives<'a, T: 'a>() {}

trait Trait<'a, T> {
    fn test();
}

impl<'a, T> Trait<'a, T> for <T as Ref<'a>>::Assoc {
    fn test() {
        outlives::<'a, T>();
    }
}

fn main() {}