Open
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 (see instructions on forge)
- Stabilization PR (see instructions on forge)
Unresolved questions:
- Work out the exact semantics / borrowck (cc @nikomatsakis, @pnkfelix)
- Add unit tests analogous to the existing
if
guard ones that testif let
guard instead - Ensure that the documentation of these details, if any, give equal footing to
if
andif let
guards. - (If there is no documentation of
if
guards 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 else
were 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?)
Metadata
Assignees
Labels
Blocker: Approved by a merged RFC and implemented.Blocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFC`#![feature(if_let_guard)]`Status: The implementation is incomplete.Relevant to the language team, which will review and decide on the PR/issue.