编者注:问题中提供的代码在 Rust 1.0 中按原样编译。
我试过了:
trait Inner {}
struct Outer<'a> {
inner: &'a Inner,
}
但编译器抱怨:
Compiling tst v0.1.0 (file:///home/chris/rust/tst)
/home/chris/rust/tst/src/main.rs:4:14: 4:19 error: explicit lifetime bound required
/home/chris/rust/tst/src/main.rs:4 inner: &'a Inner,