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
Please stop spreading misinformation. This is perfectly good code using the latest version of Rust:
fn main() {
let mut x = 5;
let y = &mut x;
*y += 1;
println!("{}", x);
}
The compiler doesn't give the following error message you claim it does:
error: cannot borrow `x` as immutable because it is also borrowed as mutable
println!("{}", x);
^
Probably in a previous version of Rust this error was returned, but the version is not specified in the text, and if this part is outdated, probably there are many more irrelevant parts in the book.
Please stop spreading misinformation. This is perfectly good code using the latest version of Rust:
The compiler doesn't give the following error message you claim it does:
Probably in a previous version of Rust this error was returned, but the version is not specified in the text, and if this part is outdated, probably there are many more irrelevant parts in the book.
Source: https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/book/first-edition/references-and-borrowing.html
The text was updated successfully, but these errors were encountered: