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