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

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

23 lines
325 B
Rust
Raw Normal View History

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