Hi,
On 2013.06.26 00:47:17 +0530, piyush agarwal wrote:
> Hi all,
>
> When I run this code
>
> fn main() {
> let mut x = @mut 2;
> let y = x;
> {
> let z = & *y;
Here, you get a borrowed pointer to the managed value in y. This
"freezes" the value, which means that as long as the borrowed pointer is
in scope, you're not allowed to change the value. For managed values,
this is checked at runtime.
> x = @mut 3;
> io::println(fmt!("%?" , y));
> *y = 5;
Here, you're trying to change the value that has been frozen, violating
the rules, and the dynamic borrow checker has identified this violation.
See
http://smallcultfollowing.com/babysteps/blog/2012/11/18/imagine-never-hearing-the-phrase-aliasable/
HTH
Björn
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev