Closed
Description
Context: #66296 (comment)
The _
below should be z
instead.
error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
--> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:31
|
LL | ref mut z @ &mut Some(ref a) => {
| ----------------------^^^^^-
| | |
| | immutable borrow occurs here
| mutable borrow occurs here
...
LL | **z = None;
| ---------- mutable borrow later used here
cc @mark-i-m @pnkfelix @matthewjasper
cc #65490
Minimal reproducer:
#![feature(bindings_after_at)]
fn foo() {
let ref mut _z @ ref _a = &mut 1;
**_z = 0;
}
Metadata
Metadata
Assignees
Labels
Area: Non-lexical lifetimes (NLL)Area: Messages for errors, warnings, and lintsCategory: This is a bug.Diagnostics: Confusing error or lint that should be reworked.`#![feature(bindings_after_at)]`Working towards the "diagnostic parity" goalRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.