]> git.lizzy.rs Git - rust.git/blob - src/test/ui/object-lifetime-default-default-to-static.rs
Auto merge of #75936 - sdroege:chunks-exact-construction-bounds-check, r=nagisa
[rust.git] / src / test / ui / object-lifetime-default-default-to-static.rs
1 // run-pass
2 // Test that `Box<Test>` is equivalent to `Box<Test+'static>`, both in
3 // fields and fn arguments.
4
5 // pretty-expanded FIXME #23616
6
7 #![allow(dead_code)]
8
9 trait Test {
10     fn foo(&self) { }
11 }
12
13 struct SomeStruct {
14     t: Box<dyn Test>,
15     u: Box<dyn Test+'static>,
16 }
17
18 fn a(t: Box<dyn Test>, mut ss: SomeStruct) {
19     ss.t = t;
20 }
21
22 fn b(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
23     ss.t = t;
24 }
25
26 fn c(t: Box<dyn Test>, mut ss: SomeStruct) {
27     ss.u = t;
28 }
29
30 fn d(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
31     ss.u = t;
32 }
33
34 fn main() {
35 }