File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
compiler/rustc_mir_build/src/thir Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -776,10 +776,10 @@ impl ToBorrowKind for hir::Mutability {
776776fn convert_arm < ' tcx > ( cx : & mut Cx < ' _ , ' tcx > , arm : & ' tcx hir:: Arm < ' tcx > ) -> Arm < ' tcx > {
777777 Arm {
778778 pattern : cx. pattern_from_hir ( & arm. pat ) ,
779- guard : match arm. guard {
780- Some ( hir:: Guard :: If ( ref e) ) => Some ( Guard :: If ( e. to_ref ( ) ) ) ,
781- _ => None ,
782- } ,
779+ guard : arm. guard . as_ref ( ) . map ( |g| match g {
780+ hir:: Guard :: If ( ref e) => Guard :: If ( e. to_ref ( ) ) ,
781+ hir :: Guard :: IfLet ( ref pat , ref e ) => Guard :: IfLet ( cx . pattern_from_hir ( pat ) , e . to_ref ( ) )
782+ } ) ,
783783 body : arm. body . to_ref ( ) ,
784784 lint_level : LintLevel :: Explicit ( arm. hir_id ) ,
785785 scope : region:: Scope { id : arm. hir_id . local_id , data : region:: ScopeData :: Node } ,
Original file line number Diff line number Diff line change @@ -344,6 +344,7 @@ crate struct Arm<'tcx> {
344344#[ derive( Clone , Debug ) ]
345345crate enum Guard < ' tcx > {
346346 If ( ExprRef < ' tcx > ) ,
347+ IfLet ( Pat < ' tcx > , ExprRef < ' tcx > ) ,
347348}
348349
349350#[ derive( Copy , Clone , Debug ) ]
You can’t perform that action at this time.
0 commit comments