Closed
Description
I tried this code:
pub fn foo(a: &[u8], b: bool) -> bool {
match b {
true if let [1, 2, 3, ..] = a => true,
_ => false,
}
}
I expected to see this happen:
The compilation fails and error points out that if-let guard is not implemented
and being tracked at #51114
Instead, this happened:
The error points to let_chains
feature, which is wrong and adding that feature gate
doesn't make the code compile.
error[E0658]: `let` expressions in this position are experimental
--> <source>:3:17
|
3 | true if let [1, 2, 3, ..] = a => true,
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information
= help: add `#![feature(let_chains)]` to the crate attributes to enable
Meta
rustc --version --verbose
:
rustc 1.46.0-nightly (8aa18cbdc 2020-07-08)
binary: rustc
commit-hash: 8aa18cbdc5d4bc33bd61e2d9a4b643d87f5d21de
commit-date: 2020-07-08
host: x86_64-unknown-linux-gnu
release: 1.46.0-nightly
LLVM version: 10.0
Compiler returned: 0