2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
2015-02-11 18:45:19 -06:00
|
|
|
// Test that `Box<Test>` is equivalent to `Box<Test+'static>`, both in
|
|
|
|
// fields and fn arguments.
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-02-11 18:45:19 -06:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
trait Test {
|
|
|
|
fn foo(&self) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SomeStruct {
|
2019-05-28 13:47:21 -05:00
|
|
|
t: Box<dyn Test>,
|
|
|
|
u: Box<dyn Test+'static>,
|
2015-02-11 18:45:19 -06:00
|
|
|
}
|
|
|
|
|
2019-05-28 13:47:21 -05:00
|
|
|
fn a(t: Box<dyn Test>, mut ss: SomeStruct) {
|
2015-02-11 18:45:19 -06:00
|
|
|
ss.t = t;
|
|
|
|
}
|
|
|
|
|
2019-05-28 13:47:21 -05:00
|
|
|
fn b(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
|
2015-02-11 18:45:19 -06:00
|
|
|
ss.t = t;
|
|
|
|
}
|
|
|
|
|
2019-05-28 13:47:21 -05:00
|
|
|
fn c(t: Box<dyn Test>, mut ss: SomeStruct) {
|
2015-02-11 18:45:19 -06:00
|
|
|
ss.u = t;
|
|
|
|
}
|
|
|
|
|
2019-05-28 13:47:21 -05:00
|
|
|
fn d(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
|
2015-02-11 18:45:19 -06:00
|
|
|
ss.u = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|