-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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
struct Foo {
u :u32,
}
impl Foo {
fn foo(&mut self) {
|| {
let r = &mut self;
r.u += 1;
};
}
}
gives
error[E0595]: closure cannot assign to immutable argument `self`
--> src/main.rs:6:9
|
6 | || {
| ^^
| |
| cannot reborrow mutably
| try removing `&mut` here
error: aborting due to previous error
error: Could not compile `playground`.
Which is very cryptic and doesn't really show what's going on.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-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.