Skip to content

Commit

Permalink
improve test for issue 89960
Browse files Browse the repository at this point in the history
  • Loading branch information
cormacrelf committed Oct 18, 2021
1 parent ab4d154 commit 5f711f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/test/ui/let-else/issue-89960.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// This had an ICE, see issue #89960

#![feature(let_else)]
#![deny(unused_variables)]

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
//~^ ERROR unused variable: `meow`
}
16 changes: 9 additions & 7 deletions src/test/ui/let-else/issue-89960.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
error[E0596]: cannot borrow value as mutable, as `val` is not declared as mutable
--> $DIR/issue-89960.rs:5:14
error: unused variable: `meow`
--> $DIR/issue-89960.rs:7:22
|
LL | let Some(ref mut meow) = Some(()) else { return };
| ---------^^^^^^^^^^^^-----------------------------
| | |
| | cannot borrow as mutable
| help: consider changing this to be mutable: `mut val`
| ^^^^ help: if this is intentional, prefix it with an underscore: `_meow`
|
note: the lint level is defined here
--> $DIR/issue-89960.rs:4:9
|
LL | #![deny(unused_variables)]
| ^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0596`.

0 comments on commit 5f711f2

Please sign in to comment.