Skip to content

Commit a1a3d97

Browse files
committed
Add ui test to for unimplementaed if let guard
1 parent 2eb44e6 commit a1a3d97

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This function is to check whether `if-let` guard error points to
2+
// `let_chains` feature gate, which is wrong and confuse people.
3+
pub fn foo(a: &[u8], b: bool) -> bool {
4+
match b {
5+
true if let [1, 2, 3, ..] = a => true,
6+
//~^ ERROR `let` expressions are not supported here
7+
//~^^ NOTE only supported directly in conditions of `if`- and `while`-expressions
8+
//~^^^ NOTE as well as when nested within `&&` and parenthesis in those conditions
9+
_ => false,
10+
}
11+
}
12+
13+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: `let` expressions are not supported here
2+
--> $DIR/non-implemented.rs:5:17
3+
|
4+
LL | true if let [1, 2, 3, ..] = a => true,
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: only supported directly in conditions of `if`- and `while`-expressions
8+
= note: as well as when nested within `&&` and parenthesis in those conditions
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)