@@ -221,27 +221,37 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
221221
222222 let init = & this. thir [ * initializer] ;
223223 let initializer_span = init. span ;
224- this. declare_bindings (
225- visibility_scope,
226- remainder_span,
227- pattern,
228- ArmHasGuard ( false ) ,
229- Some ( ( None , initializer_span) ) ,
230- ) ;
231- this. visit_primary_bindings (
232- pattern,
233- UserTypeProjections :: none ( ) ,
234- & mut |this, _, _, _, node, span, _, _| {
235- this. storage_live_binding ( block, node, span, OutsideGuard , true ) ;
236- this. schedule_drop_for_binding ( node, span, OutsideGuard ) ;
237- } ,
238- ) ;
239224 let failure = unpack ! (
240225 block = this. in_opt_scope(
241226 opt_destruction_scope. map( |de| ( de, source_info) ) ,
242227 |this| {
243228 let scope = ( * init_scope, source_info) ;
244229 this. in_scope( scope, * lint_level, |this| {
230+ this. declare_bindings(
231+ visibility_scope,
232+ remainder_span,
233+ pattern,
234+ ArmHasGuard ( false ) ,
235+ Some ( ( None , initializer_span) ) ,
236+ ) ;
237+ this. visit_primary_bindings(
238+ pattern,
239+ UserTypeProjections :: none( ) ,
240+ & mut |this, _, _, _, node, span, _, _| {
241+ this. storage_live_binding(
242+ block,
243+ node,
244+ span,
245+ OutsideGuard ,
246+ true ,
247+ ) ;
248+ this. schedule_drop_for_binding(
249+ node,
250+ span,
251+ OutsideGuard ,
252+ ) ;
253+ } ,
254+ ) ;
245255 this. ast_let_else(
246256 block,
247257 init,
@@ -306,7 +316,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
306316 ArmHasGuard ( false ) ,
307317 Some ( ( None , initializer_span) ) ,
308318 ) ;
309- this. expr_into_pattern( block, & pattern, init) // irrefutable pattern
319+ this. expr_into_pattern( block, & pattern, init)
320+ // irrefutable pattern
310321 } )
311322 } ,
312323 )
0 commit comments