Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if-let guard point to let_chains issue #74232

Closed
tesuji opened this issue Jul 11, 2020 · 0 comments · Fixed by #74566
Closed

if-let guard point to let_chains issue #74232

tesuji opened this issue Jul 11, 2020 · 0 comments · Fixed by #74566
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tesuji
Copy link
Contributor

tesuji commented Jul 11, 2020

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
@tesuji tesuji added the C-bug Category: This is a bug. label Jul 11, 2020
@tesuji tesuji changed the title if-let arm point to let_chains issue if-let guard point to let_chains issue Jul 11, 2020
@JohnTitor JohnTitor added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 14, 2020
@bors bors closed this as completed in 5528caf Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants