-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inconsistent behaviour regarding @mut and &mut in managed and borrowed reference types #5720
Comments
This is expected behavior. The reason is that you are allowed to take immutable references to mutable data, which causes the mutable data to be frozen. (This is what is happening when you assign to |
Seems very very strange to me (that assignment to variables I'll try to update the tutorial to explain this. No, maybe I won't just yet, there's enough other documentation on Rust I haven't yet read. |
This is some stuff which seemed to be missing to me (though I haven't read everything yet so hope I haven't missed the relevant section). A similar addition for borrowing handles is needed, but #5720 stumped me. Comments welcome.
Add unnecessary lazy evaluation lint changelog: Add [`unnecessary_lazy_evaluations`] lint that checks for usages of `unwrap_or_else` and similar functions that can be simplified. Closes rust-lang#5715
Using
@int
instead of@mut int
in a type causes a compile error, but using&int
instead of&mut int
does not.This could be intended behaviour, but I presume not since as I understand it variable typing is either automatic (from the rvalue) or explicit, not some mixture of the two.
The text was updated successfully, but these errors were encountered: