rust/tests/ui/borrowck/alias-liveness/rpit-static.rs

23 lines
325 B
Rust
Raw Normal View History

//@ check-pass
trait Captures<'a> {}
impl<T> Captures<'_> for T {}
2023-10-14 09:28:44 -05:00
fn foo(x: &mut i32) -> impl Sized + Captures<'_> + 'static {}
2023-10-14 09:28:44 -05:00
fn overlapping_mut() {
let i = &mut 1;
let x = foo(i);
let y = foo(i);
}
fn live_past_borrow() {
let y;
{
2023-10-14 09:28:44 -05:00
let x = &mut 1;
y = foo(x);
}
}
2023-10-14 09:28:44 -05:00
fn main() {}