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 {
776
776
fn convert_arm < ' tcx > ( cx : & mut Cx < ' _ , ' tcx > , arm : & ' tcx hir:: Arm < ' tcx > ) -> Arm < ' tcx > {
777
777
Arm {
778
778
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
+ } ) ,
783
783
body : arm. body . to_ref ( ) ,
784
784
lint_level : LintLevel :: Explicit ( arm. hir_id ) ,
785
785
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> {
344
344
#[ derive( Clone , Debug ) ]
345
345
crate enum Guard < ' tcx > {
346
346
If ( ExprRef < ' tcx > ) ,
347
+ IfLet ( Pat < ' tcx > , ExprRef < ' tcx > ) ,
347
348
}
348
349
349
350
#[ derive( Copy , Clone , Debug ) ]
You can’t perform that action at this time.
0 commit comments