rust/tests/ui/object-lifetime/object-lifetime-default-default-to-static.rs
许杰友 Jieyou Xu (Joe) 95ff642797 tests: remove //@ pretty-expanded usages
Done with

```bash
sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs
```

and

```
sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs
```
2024-11-26 02:50:48 +08:00

35 lines
527 B
Rust

//@ run-pass
// Test that `Box<Test>` is equivalent to `Box<Test+'static>`, both in
// fields and fn arguments.
#![allow(dead_code)]
trait Test {
fn foo(&self) { }
}
struct SomeStruct {
t: Box<dyn Test>,
u: Box<dyn Test+'static>,
}
fn a(t: Box<dyn Test>, mut ss: SomeStruct) {
ss.t = t;
}
fn b(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
ss.t = t;
}
fn c(t: Box<dyn Test>, mut ss: SomeStruct) {
ss.u = t;
}
fn d(t: Box<dyn Test+'static>, mut ss: SomeStruct) {
ss.u = t;
}
fn main() {
}