summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-close-param-into-object.rs
blob: 2760e5eed9595c5be1ede8cde7f2c785bc42c443 (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
trait X { fn foo(&self) {} }

fn p1<T>(v: T) -> Box<dyn X + 'static>
    where T : X
{
    Box::new(v) //~ ERROR parameter type `T` may not live long enough
}

fn p2<T>(v: Box<T>) -> Box<dyn X + 'static>
    where Box<T> : X
{
    Box::new(v) //~ ERROR parameter type `T` may not live long enough
}

fn p3<'a,T>(v: T) -> Box<dyn X + 'a>
    where T : X
{
    Box::new(v) //~ ERROR parameter type `T` may not live long enough
}

fn p4<'a,T>(v: Box<T>) -> Box<dyn X + 'a>
    where Box<T> : X
{
    Box::new(v) //~ ERROR parameter type `T` may not live long enough
}

fn main() {}