Closed
Description
This code
fn impure_fn(_: &[int]) { }
fn takes_a_borrowed_ptr(v: & ~mut [int]) {
impure_fn(*v);
}
fails to compile with the error
error: illegal borrow unless pure: creating immutable alias to mutable vec content
impure_fn(*v);
^~
note: impure due to access to impure function
impure_fn(*v);
^~~~~~~~~
This seems wrong to me because this function compiles fine:
fn takes_an_owned_vec(v: ~mut [int]) {
impure_fn(v);
}
Neither one will compile if the ~mut
are changed to @mut
(both give the same error as I already quoted), which makes sense to me.
Apologies if I'm missing something obvious here.
Metadata
Metadata
Assignees
Labels
No labels