summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/regions-close-object-into-object-4.rs
blob: 3bbad9cbffedb2de0565727a4580f2d29b56fdc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
trait A<T> { }

struct B<'a, T:'a>(&'a (dyn A<T> + 'a));

trait X { }
impl<'a, T> X for B<'a, T> {}

fn i<'a, T, U>(v: Box<dyn A<U>+'a>) -> Box<dyn X + 'static> {
    Box::new(B(&*v)) as Box<dyn X>
    //~^ ERROR the parameter type `U` may not live long enough [E0310]
    //~| ERROR the parameter type `U` may not live long enough [E0310]
    //~| ERROR the parameter type `U` may not live long enough [E0310]
    //~| ERROR lifetime may not live long enough
    //~| ERROR cannot return value referencing local data `*v` [E0515]
    //~| ERROR the parameter type `U` may not live long enough [E0310]

}

fn main() {}