2019-07-27 00:54:25 +03:00
|
|
|
//@ run-pass
|
2015-02-11 19:45:19 -05:00
|
|
|
// Test that the lifetime of the enclosing `&` is used for the object
|
|
|
|
// lifetime bound.
|
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
//@ pretty-expanded FIXME #23616
|
|
|
|
|
2015-02-11 19:45:19 -05:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
trait Test {
|
|
|
|
fn foo(&self) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SomeStruct<'a> {
|
2019-05-28 14:47:21 -04:00
|
|
|
t: &'a mut dyn Test,
|
|
|
|
u: &'a mut (dyn Test+'a),
|
2015-02-11 19:45:19 -05:00
|
|
|
}
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
fn a<'a>(t: &'a mut dyn Test, mut ss: SomeStruct<'a>) {
|
2015-02-11 19:45:19 -05:00
|
|
|
ss.t = t;
|
|
|
|
}
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
fn b<'a>(t: &'a mut dyn Test, mut ss: SomeStruct<'a>) {
|
2015-02-11 19:45:19 -05:00
|
|
|
ss.u = t;
|
|
|
|
}
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
fn c<'a>(t: &'a mut (dyn Test+'a), mut ss: SomeStruct<'a>) {
|
2015-02-11 19:45:19 -05:00
|
|
|
ss.t = t;
|
|
|
|
}
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
fn d<'a>(t: &'a mut (dyn Test+'a), mut ss: SomeStruct<'a>) {
|
2015-02-11 19:45:19 -05:00
|
|
|
ss.u = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|