]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/object-lifetime-default-default-to-static.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[rust.git] / src / test / run-pass / object-lifetime-default-default-to-static.rs
1 // Copyright 2015 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 // Test that `Box<Test>` is equivalent to `Box<Test+'static>`, both in
12 // fields and fn arguments.
13
14 // pretty-expanded FIXME #23616
15
16 #![allow(dead_code)]
17
18 trait Test {
19     fn foo(&self) { }
20 }
21
22 struct SomeStruct {
23     t: Box<Test>,
24     u: Box<Test+'static>,
25 }
26
27 fn a(t: Box<Test>, mut ss: SomeStruct) {
28     ss.t = t;
29 }
30
31 fn b(t: Box<Test+'static>, mut ss: SomeStruct) {
32     ss.t = t;
33 }
34
35 fn c(t: Box<Test>, mut ss: SomeStruct) {
36     ss.u = t;
37 }
38
39 fn d(t: Box<Test+'static>, mut ss: SomeStruct) {
40     ss.u = t;
41 }
42
43 fn main() {
44 }