I have the following function:
fn add_equal(x: &mut Complex, y: &Complex) {
x.real += y.real;
x.imag += y.imag;
}
Calling the function with the same variable being passed to both arguments
(i.e. add_equal(&mut c, &c)), results in the compile error:
error: cannot borrow `c` as immutable because it is also borrowed as mutable
I am guessing this is to avoid aliasing issues? What is the way around this?
Thanks
--
Ziad
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev