Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on I Want Off Mr. Golang's Wild Ride. Parent comment
I will be precise. There is no definition of f such that this function will print anything other than "4".
fn main() { let mut x = 4; f(x); println!("{}", x); }
There are no comments on this comment yet.
I will be precise. There is no definition of f such that this function will print anything other than "4".
Again, you seem to be confusing mutable references and mutable variables. If I had written f(&mut x) rather than f(x), you would be right.