Hi all,
This code used to work in 0.5 version but wehn i updated my compiler to
prerelease of 0.6 , these errors occurs which I am not able to understand.
#[link(name = "testVector", vers = "1.0")];
#[crate_type = "lib"];
extern mod std;
pub struct test {
testStruct: @mut([~[int], ..4])
}
impl test {
pub fn print_lenght(&mut self) {
io::println(uint::to_str(self.testStruct[2].len()));
}
}
fn test() -> @mut test{
@mut test {
testStruct: @mut([~[], ..4])
}
}
testVector.rs:12:27: 12:44 error: illegal borrow unless pure: unique value
in aliasable, mutable location
testVector.rs:12 io::println(uint::to_str(self.testStruct[2].len()));
^~~~~~~~~~~~~~~~~
testVector.rs:12:27: 12:52 note: impure due to access to impure function
testVector.rs:12 io::println(uint::to_str(self.testStruct[2].len()));
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev