about summary refs log tree commit diff
path: root/tests/ui/regions/issue-11612.rs
blob: af0071e10889fdca1ccc5dce254e156874d20576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//@ check-pass
#![allow(dead_code)]
// #11612
// We weren't updating the auto adjustments with all the resolved
// type information after type check.


trait A { fn dummy(&self) { } }

struct B<'a, T:'a> {
    f: &'a T
}

impl<'a, T> A for B<'a, T> {}

fn foo(_: &dyn A) {}

fn bar<G>(b: &B<G>) {
    foo(b);       // Coercion should work
    foo(b as &dyn A); // Explicit cast should work as well
}

fn main() {}