Skip to content

let expressions in this position are unstable #142111

Closed
@kakserpom

Description

@kakserpom

Stable Rust:

error[E0658]: `let` expressions in this position are unstable
   --> src/lib.rs:331:24
    |
331 |                     if let Some(&n1) = transitions.get(b.as_ref()) && let Some(&n2) = self.nodes[n1].transitions.get(a.as_ref())
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information

error[E0658]: `let` expressions in this position are unstable
   --> src/lib.rs:331:71
    |
331 |                     if let Some(&n1) = transitions.get(b.as_ref()) && let Some(&n2) = self.nodes[n1].transitions.get(a.as_ref())
    |                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information

Of course I've rewritten this as:

if let Some(&node) = transitions.get(b.as_ref()).and_then(|&x| self.nodes[x].transitions.get(a.as_ref()))

But it still looks like a bug to me, because #53667 is marked as completed and closed.

Meta

rustc --version --verbose:

rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: aarch64-apple-darwin
release: 1.87.0
LLVM version: 20.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions