- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
Description
Note: This feature was stabilized in 1.88.0 but on edition 2024 only. If you are using 1.88.0+ and get an error that the feature is still unstable, please upgrade the edition. The error message is being improved.
This is a tracking issue for the eRFC "if- and while-let-chains, take 2" (rust-lang/rfcs#2497).
For the tracking issue for the immediate edition changes, see #53668.
Steps:
- Implement the RFC (cc @rust-lang/compiler -- can anyone write up mentoring instructions?)
- Adjust documentation (see instructions on forge)
- Formatting for new syntax has been added to the Style Guide (nightly-style-procedure)
- resolve expr fragment specifier issue (#86730)
-  Initial stabilization PR: Stabilize let_chainsin Rust 1.64 #94927, reverted in Revert let_chains stabilization #100538
- Second stabilization PR: Stabilize let chains in the 2024 edition #132833
- followups let_chains stabilization followups #140722
- Remove let_chains unstable feature #143214
Unresolved questions:
-  The final syntax
- This would benefit from a design note summarizing previous discussions on letas a boolean expression, and possibilities ofissyntax.
 
- This would benefit from a design note summarizing previous discussions on 
- Should temporary and irrefutable lets without patterns be allowed in some form?
-  Chained if lets insidematcharms
Collected issues:
-  unused_parens incorrectly lints on if let true = (false && true) {}#60336
-  Cleanup hack to expect scrutinee: boolin if-to-match desugaring in match-expr typeck #60707
-  Deduplicate diagnostics in if-without-else-as-fn-expr.rs#60254
-  MIR building for match $c { true => $i, _ => $e }is slow #60571
-  Suggest if letwhen a failedifblock could be parsed as one #44990
Implementation history:
- Run branch cleanup after copy prop #59290
- Generalize diagnostic for x = ywhereboolis the expected type #59439
- Introduce hir::ExprKind::Use and employ in for loop desugaring. #60225
- [let_chains, 1/6] Remove hir::ExprKind::If #59288
- [let_chains, 2/6] Introduce Let(..)in AST, remove IfLet + WhileLet and parse let chains #60861
- [let_chains, 3/6] And then there was only Loop #61988
- Reintroduce hir::ExprKind::If #79328
- Introduce hir::ExprKind::Let- Take 2 #80357
- Lower condition of ifexpression before it's "then" block #82308
- Formally implement let chains #88642
- Add tests to ensure that let_chainsworks withif_let_guard#93086
- Fix let_chainsandif_let_guardfeature flags #93213
- [rustc_parse] Forbid lets in certain places #97295
- Warn users about ||in let chain expressions #94754
- Ensure that let_elsedoes not interact withlet_chains#94974
- [let_chains] Forbidletinside parentheses #95008
- Tell users that ||operators are not currently supported in let chain expressions #95314
Unresolved problems
- Can we be confident that the implementation is correct and well tested?
zesterer, MatusT, ozars, mtrsl, 0b01 and 428 morebb010g, jmoore34, Bendrien, schneiderfelipe, gilescope and 39 moredzmitry-lahoda, Hocuri, GreeFine, LDSpits, hurlenko and 81 moredzmitry-lahoda, 35359595, hurlenko, henryboisdequin, Tanja-4732 and 66 moreschneiderfelipe, luminosoda, nepali-prabhat, branchseer, dzmitry-lahoda and 16 more
Metadata
Metadata
Assignees
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-let_chains`#![feature(let_chains)]``#![feature(let_chains)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team