@@ -66,6 +66,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6666                    ( if_then_scope,  then_source_info) , 
6767                    LintLevel :: Inherited , 
6868                    |this| { 
69+                         // FIXME: Does this need extra logic to handle let-chains? 
6970                        let  source_info = if  this. is_let ( cond)  { 
7071                            let  variable_scope =
7172                                this. new_source_scope ( then_span,  LintLevel :: Inherited ,  None ) ; 
@@ -74,6 +75,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
7475                        }  else  { 
7576                            this. source_info ( then_span) 
7677                        } ; 
78+ 
79+                         // Lower the condition, and have it branch into `then` and `else` blocks. 
7780                        let  ( then_block,  else_block)  =
7881                            this. in_if_then_scope ( condition_scope,  then_span,  |this| { 
7982                                let  then_blk = unpack ! ( this. then_else_break( 
@@ -85,8 +88,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
8588                                    true ,  // Declare `let` bindings normally 
8689                                ) ) ; 
8790
91+                                 // Lower the `then` arm into its block. 
8892                                this. expr_into_dest ( destination,  then_blk,  then) 
8993                            } ) ; 
94+ 
95+                         // Pack `(then_block, else_block)` into `BlockAnd<BasicBlock>`. 
9096                        then_block. and ( else_block) 
9197                    } , 
9298                ) ; 
@@ -105,6 +111,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
105111                    this. cfg . push_assign_unit ( else_blk,  correct_si,  destination,  this. tcx ) ; 
106112                } 
107113
114+                 // The `then` and `else` arms have been lowered into their respective 
115+                 // blocks, so make both of them meet up in a new block. 
108116                let  join_block = this. cfg . start_new_block ( ) ; 
109117                this. cfg . goto ( then_blk,  source_info,  join_block) ; 
110118                this. cfg . goto ( else_blk,  source_info,  join_block) ; 
0 commit comments