rust/tests/ui/object-lifetime/object-lifetime-default-default-to-static.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
558 B
Rust
Raw Normal View History

// run-pass
// Test that `Box<Test>` is equivalent to `Box<Test+'static>`, both in
// fields and fn arguments.
// pretty-expanded FIXME #23616
#![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>,
}
2019-05-28 18:47:21 +00:00
fn a(t: Box<dyn Test>, mut ss: SomeStruct) {
ss.t = t;
}
2019-05-28 18:47:21 +00:00
fn b(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
ss.t = t;
}
2019-05-28 18:47:21 +00:00
fn c(t: Box<dyn Test>, mut ss: SomeStruct) {
ss.u = t;
}
2019-05-28 18:47:21 +00:00
fn d(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
ss.u = t;
}
fn main() {
}