about summary refs log tree commit diff
path: root/tests/ui/borrowck/alias-liveness/rpit-static.rs
blob: 98209f5f3b9fdd3883c6580852aa3b2d4d817775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//@ check-pass

trait Captures<'a> {}
impl<T> Captures<'_> for T {}

fn foo(x: &mut i32) -> impl Sized + Captures<'_> + 'static {}

fn overlapping_mut() {
    let i = &mut 1;
    let x = foo(i);
    let y = foo(i);
}

fn live_past_borrow() {
    let y;
    {
        let x = &mut 1;
        y = foo(x);
    }
}

fn main() {}