forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#89965 - JohnTitor:fix-let-else-ice-with-ref…
…-mut, r=petrochenkov Fix ICE with `let...else` and `ref mut` Fixes rust-lang#89960, opened for review. I'm not satisfied with the current diagnostics, any ideas?
- Loading branch information
Showing
3 changed files
with
27 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |