Skip to content

Commit 5f711f2

Browse files
committed
improve test for issue 89960
1 parent ab4d154 commit 5f711f2

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/test/ui/let-else/issue-89960.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// This had an ICE, see issue #89960
2+
13
#![feature(let_else)]
4+
#![deny(unused_variables)]
25

36
fn main() {
4-
// FIXME: more precise diagnostics
57
let Some(ref mut meow) = Some(()) else { return };
6-
//~^ ERROR: cannot borrow value as mutable, as `val` is not declared as mutable
8+
//~^ ERROR unused variable: `meow`
79
}

src/test/ui/let-else/issue-89960.stderr

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
error[E0596]: cannot borrow value as mutable, as `val` is not declared as mutable
2-
--> $DIR/issue-89960.rs:5:14
1+
error: unused variable: `meow`
2+
--> $DIR/issue-89960.rs:7:22
33
|
44
LL | let Some(ref mut meow) = Some(()) else { return };
5-
| ---------^^^^^^^^^^^^-----------------------------
6-
| | |
7-
| | cannot borrow as mutable
8-
| help: consider changing this to be mutable: `mut val`
5+
| ^^^^ help: if this is intentional, prefix it with an underscore: `_meow`
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/issue-89960.rs:4:9
9+
|
10+
LL | #![deny(unused_variables)]
11+
| ^^^^^^^^^^^^^^^^
912

1013
error: aborting due to previous error
1114

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

0 commit comments

Comments
 (0)