Fix ICE with let...else and ref mut
This commit is contained in:
parent
7fbd4ce276
commit
bf7c32a447
3 changed files with 27 additions and 8 deletions
7
src/test/ui/let-else/issue-89960.rs
Normal file
7
src/test/ui/let-else/issue-89960.rs
Normal 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
|
||||
}
|
||||
12
src/test/ui/let-else/issue-89960.stderr
Normal file
12
src/test/ui/let-else/issue-89960.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue