Repository navigation
Tracking issue for RFC 2294, "if let guard" #51114
Copy link
Copy link
Closed
Labels
B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.Blocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.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-if_let_guard`#![feature(if_let_guard)]``#![feature(if_let_guard)]`S-tracking-impl-incompleteStatus: The implementation is incomplete.Status: The implementation is incomplete.T-langRelevant to the language teamRelevant to the language team
Description
This is a tracking issue for the RFC "if let guard" (rust-lang/rfcs#2294).
Steps:
- Implement the RFC (implemented in Implement if-let match guards #79051)
- Adjust documentation
- Stabilization PR
Unresolved questions:
- Work out the exact semantics / borrowck (cc @nikomatsakis, @pnkfelix)
- Add unit tests analogous to the existing
ifguard ones that testif letguard instead - Ensure that the documentation of these details, if any, give equal footing to
ifandif letguards. - (If there is no documentation of
ifguards behavior w.r.t. move semantics, I do not think that should hold up stabilizing this feature. We can just file an issue that those things need to be documented.)
- Add unit tests analogous to the existing
- pnkfelix: The fact that both this feature and
let elsewere implemented but had problems discovered relatively late with their handling of certain details w.r.t. locals and temporary r-values is a hint that we may need to revisit our approach to testing features like this more broadly, in terms of how we advise implementors of such features on how to probe for such cases (and maybe also in the form of some kind of language-oriented test-generation tooling?)
Reacted by Luo Jia / Zhouqi Jiang, Philip Munksgaard, Silhalnor, Simon Otter, NyxCode, Luna Razzaghipour, Jonas Platte, Arnau Orriols, d4h0, tesuji and 132 more
Reacted by James C. Wise, Felipe S. S. Schneider, Pavel Atanasov, Longsueynin, Jaanus Varus, bʊlʃɪt and ben
Reacted by Sudip Ghimire, Kevin Kamper Meejach Petersen, Yujin, Abhik Jain, Evgeniy Dushistov, demn, Ivan, Ell, Robert, ldanko and 14 more
Metadata
Metadata
Assignees
Labels
B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.Blocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.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-if_let_guard`#![feature(if_let_guard)]``#![feature(if_let_guard)]`S-tracking-impl-incompleteStatus: The implementation is incomplete.Status: The implementation is incomplete.T-langRelevant to the language teamRelevant to the language team
Activity
imjacobclark commentedon Jan 9, 2019
👋 After a conversation about this change with @varkor I'm starting to take a look at this with a view to implementing it!
alexreg commentedon May 6, 2019
@imjacobclark Hey. Any progress over the past few months? :-)
ebkalderon commentedon Jun 5, 2019
Just ran into a case where this ability would be useful. I look forward to this feature landing someday!
Vincent-liuwingsang commentedon Jun 16, 2019
+1 This would be a nice feature to have!
Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkov
Rollup merge of rust-lang#62075 - Centril:guardless-match-arms, r=pet…
Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkov
Silhalnor commentedon Aug 1, 2019
Am currently learning Rust and thought it was unintuitive that I couldn't write this syntax. (Thought I must be mis-writing it somehow.) Lo, here it is in progress! Woo~
Boscop commentedon Mar 17, 2020
Any update on this? :)
100 remaining items
fix(emitter): skip setFunctionName for named decorated classes (#4012)
fix(emitter): honor embedded tsconfig defaults (#3975)
fix(emitter): defer repeated CommonJS export aliases (#4001)
fix(emitter): inline namespace const enum references (#3953)
fix(emitter): lower captured async ES5 loops (#4241)
fix(build): restore emitter test compilation (#3935)
fix(emitter): reuse for-await using value temps (#4328)
Fix CI: rewrite if-let guard as match (stable Rust)
refactor(wacore): replace if-let-guard with bare boolean guard
Auto merge of #141295 - Kivooeo:if-let-guard-stable, r=fee1-dead,est31
Auto merge of #141295 - Kivooeo:if-let-guard-stable, r=fee1-dead,est31
Auto merge of rust-lang#143376 - dianne:guard-scope, r=matthewjasper
Auto merge of rust-lang#143376 - dianne:guard-scope, r=matthewjasper
Pin bottom to a version rustc 1.90 can actually build
Replace the if-let guard with a stable match