Fix ICE with let...else and ref mut

This commit is contained in:
Yuki Okushi 2021-10-17 07:12:22 +09:00
parent 7fbd4ce276
commit bf7c32a447
No known key found for this signature in database
GPG key ID: DABA5B072961C18A
3 changed files with 27 additions and 8 deletions

View file

@ -0,0 +1,7 @@
#![feature(let_else)]
fn main() {
// FIXME: more precise diagnostics
let Some(ref mut meow) = Some(()) else { return };
//~^ ERROR: cannot borrow value as mutable, as `val` is not declared as mutable
}

View file

@ -0,0 +1,12 @@
error[E0596]: cannot borrow value as mutable, as `val` is not declared as mutable
--> $DIR/issue-89960.rs:5:14
|
LL | let Some(ref mut meow) = Some(()) else { return };
| ---------^^^^^^^^^^^^-----------------------------
| | |
| | cannot borrow as mutable
| help: consider changing this to be mutable: `mut val`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0596`.