summary refs log tree commit diff
path: root/src/test/compile-fail/borrowck-lend-args.rs
blob: 4fbc51183ce5a5b9cc87834dcde439e246b43bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
fn borrow(_v: &int) {}

fn borrow_from_arg_imm_ref(&&v: ~int) {
    borrow(v);
}

fn borrow_from_arg_mut_ref(&v: ~int) {
    borrow(v); //~ ERROR illegal borrow unless pure: unique value in aliasable, mutable location
    //~^ NOTE impure due to access to impure function
}

fn borrow_from_arg_move(-v: ~int) {
    borrow(v);
}

fn borrow_from_arg_copy(+v: ~int) {
    borrow(v);
}

fn borrow_from_arg_val(++v: ~int) {
    borrow(v);
}

fn main() {
}