rust-lang / rust-lang/rust

`super let` is allowed in nonsensical positions

Open
#142,281 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-discussion F-super_let I-lang-radar T-lang
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

#![feature(super_let)]

fn f() {
    super let a = 1;
}

fn g() {
    loop {
        super let b = 2;
    }
}

fn h() {
    while {
        super let c = 3;
        false
    } {}
}

I expected all three functions to fail to compile, since super let is used in places that don't make sense. However, they compiled without errors. (As far as I can tell, these super let bindings behave exactly like normal let bindings.)

@rustbot labels +F-super_let

Meta

Reproducible on the playground with 1.89.0-nightly (2025-06-09 d13a431a6cc69cd65efe)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the three snippets from the issue on the Rust nightly playground and compare how super let behaves in each position. Trace the compiler's handling of super let from the resulting diagnostics or implementation entry point, then add coverage showing that these nonsensical positions are rejected.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.