]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/regions-close-param-into-object.rs
rollup merge of #20518: nagisa/weighted-bool
[rust.git] / src / test / compile-fail / regions-close-param-into-object.rs
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
11
12 trait X {}
13
14 fn p1<T>(v: T) -> Box<X+'static>
15     where T : X
16 {
17     box v //~ ERROR parameter type `T` may not live long enough
18 }
19
20 fn p2<T>(v: Box<T>) -> Box<X+'static>
21     where Box<T> : X
22 {
23     box v //~ ERROR parameter type `T` may not live long enough
24 }
25
26 fn p3<'a,T>(v: T) -> Box<X+'a>
27     where T : X
28 {
29     box v //~ ERROR parameter type `T` may not live long enough
30 }
31
32 fn p4<'a,T>(v: Box<T>) -> Box<X+'a>
33     where Box<T> : X
34 {
35     box v //~ ERROR parameter type `T` may not live long enough
36 }
37
38 fn main() {}
39