2023-09-21 13:02:22 -05:00
|
|
|
//@ check-pass
|
|
|
|
|
|
|
|
trait Foo {
|
|
|
|
type Assoc<'a>
|
|
|
|
where
|
|
|
|
Self: 'a;
|
|
|
|
|
|
|
|
fn assoc(&mut self) -> Self::Assoc<'_>;
|
|
|
|
}
|
|
|
|
|
2023-10-14 09:28:44 -05:00
|
|
|
fn overlapping_mut<T>(mut t: T)
|
2023-09-21 13:02:22 -05:00
|
|
|
where
|
|
|
|
T: Foo,
|
|
|
|
for<'a> T::Assoc<'a>: 'static,
|
|
|
|
{
|
|
|
|
let a = t.assoc();
|
|
|
|
let b = t.assoc();
|
|
|
|
}
|
|
|
|
|
2023-10-14 09:28:44 -05:00
|
|
|
fn live_past_borrow<T>(mut t: T)
|
|
|
|
where
|
|
|
|
T: Foo,
|
|
|
|
for<'a> T::Assoc<'a>: 'static {
|
|
|
|
let x = t.assoc();
|
|
|
|
drop(t);
|
|
|
|
drop(x);
|
|
|
|
}
|
|
|
|
|
2023-09-21 13:02:22 -05:00
|
|
|
fn main() {}
|