Idea: change the desugaring of if let
to improve borrow checking
#2068
Labels
T-lang
Relevant to the language team, which will review and decide on the RFC.
Related: rust-lang/rust#28449
Currently
if let
desugars to a match with guards. Using the example from the related post:Desugars to
However, this leads to
f
being borrowed in theelse if
which is truly annoying. Instead, I propose the following desugaring:Which (I believe) does not suffer from the same problem.
One unanswered question is: does non-lexical lifetimes solve this?
The text was updated successfully, but these errors were encountered: