]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/regions-close-param-into-object.rs
New upstream version 1.29.0+dfsg1
[rustc.git] / src / test / compile-fail / regions-close-param-into-object.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
85aaf69f 11trait X { fn foo(&self) {} }
1a4d82fc
JJ
12
13fn p1<T>(v: T) -> Box<X+'static>
14 where T : X
15{
c34b1796 16 Box::new(v) //~ ERROR parameter type `T` may not live long enough
1a4d82fc
JJ
17}
18
19fn p2<T>(v: Box<T>) -> Box<X+'static>
20 where Box<T> : X
21{
c34b1796 22 Box::new(v) //~ ERROR parameter type `T` may not live long enough
1a4d82fc
JJ
23}
24
25fn p3<'a,T>(v: T) -> Box<X+'a>
26 where T : X
27{
c34b1796 28 Box::new(v) //~ ERROR parameter type `T` may not live long enough
1a4d82fc
JJ
29}
30
31fn p4<'a,T>(v: Box<T>) -> Box<X+'a>
32 where Box<T> : X
33{
c34b1796 34 Box::new(v) //~ ERROR parameter type `T` may not live long enough
1a4d82fc
JJ
35}
36
37fn main() {}