rust/tests/ui/object-lifetime/object-lifetime-default-from-rptr-mut.rs

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

37 lines
594 B
Rust
Raw Normal View History

// run-pass
// Test that the lifetime of the enclosing `&` is used for the object
// lifetime bound.
// pretty-expanded FIXME #23616
#![allow(dead_code)]
trait Test {
fn foo(&self) { }
}
struct SomeStruct<'a> {
2019-05-28 13:47:21 -05:00
t: &'a mut dyn Test,
u: &'a mut (dyn Test+'a),
}
2019-05-28 13:47:21 -05:00
fn a<'a>(t: &'a mut dyn Test, mut ss: SomeStruct<'a>) {
ss.t = t;
}
2019-05-28 13:47:21 -05:00
fn b<'a>(t: &'a mut dyn Test, mut ss: SomeStruct<'a>) {
ss.u = t;
}
2019-05-28 13:47:21 -05:00
fn c<'a>(t: &'a mut (dyn Test+'a), mut ss: SomeStruct<'a>) {
ss.t = t;
}
2019-05-28 13:47:21 -05:00
fn d<'a>(t: &'a mut (dyn Test+'a), mut ss: SomeStruct<'a>) {
ss.u = t;
}
fn main() {
}