summary refs log tree commit diff
path: root/src/test/ui/borrowck/two-phase-method-receivers.rs
blob: f1df1a6a2c8993f497b46a2bf4770119abe5fa22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// compile-flags: -Z borrowck=mir -Z two-phase-borrows

// run-pass

struct Foo<'a> {
    x: &'a i32
}

impl<'a> Foo<'a> {
    fn method(&mut self, _: &i32) {
    }
}

fn main() {
    let a = &mut Foo { x: &22 };
    Foo::method(a, a.x);
}