-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Consider the following code:
fn main() {
let mut x = 5;
{
let r = &mut x;
r = 10;
}
println!("{}", x);
}
Compiling this produces the following error:
mutref.rs:5:13: 5:15 error: mismatched types [E0308]
mutref.rs:5 r = 10;
^~
mutref.rs:5:13: 5:15 help: run `rustc --explain E0308` to see a detailed explanation
mutref.rs:5:13: 5:15 note: expected type `&mut _`
mutref.rs:5:13: 5:15 note: found type `_`
error: aborting due to previous error
Ideally, this error should include a suggestion that the user probably meant to assign to *r
.
songroom2016
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.