You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn main()
{
let mut x = ~mut 3;
assert *x == 3;
*x = 4;
assert *x == 4;
x = ~5;
assert *x == 5;
}
gives me a somewhat confusing error
1.rs:5:4: 5:6 error: assigning to dereference of const ~ pointer
1.rs:5 *x = 4;
^~
Took me a while to figure out that the last assignment was forcing x to become a const ptr for its entire life. That was my mistake, but causing an error earlier in the function threw me off. It would be nice if the compiler explained why the type of x was not what it appeared to be.