@@ -60,39 +60,25 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6060 if Some ( 0 ) == count. try_eval_target_usize ( this. tcx , this. param_env ) {
6161 this. build_zero_repeat ( block, value, scope, source_info)
6262 } else {
63- let value_operand = unpack ! (
64- block = this. as_operand(
65- block,
66- scope,
67- value,
68- LocalInfo :: Boring ,
69- NeedsTemporary :: No
70- )
71- ) ;
63+ let value_operand = this
64+ . as_operand ( block, scope, value, LocalInfo :: Boring , NeedsTemporary :: No )
65+ . unpack ( & mut block) ;
7266 block. and ( Rvalue :: Repeat ( value_operand, count) )
7367 }
7468 }
7569 ExprKind :: Binary { op, lhs, rhs } => {
76- let lhs = unpack ! (
77- block = this. as_operand(
78- block,
79- scope,
80- lhs,
81- LocalInfo :: Boring ,
82- NeedsTemporary :: Maybe
83- )
84- ) ;
85- let rhs = unpack ! (
86- block =
87- this. as_operand( block, scope, rhs, LocalInfo :: Boring , NeedsTemporary :: No )
88- ) ;
70+ let lhs = this
71+ . as_operand ( block, scope, lhs, LocalInfo :: Boring , NeedsTemporary :: Maybe )
72+ . unpack ( & mut block) ;
73+ let rhs = this
74+ . as_operand ( block, scope, rhs, LocalInfo :: Boring , NeedsTemporary :: No )
75+ . unpack ( & mut block) ;
8976 this. build_binary_op ( block, op, expr_span, expr. ty , lhs, rhs)
9077 }
9178 ExprKind :: Unary { op, arg } => {
92- let arg = unpack ! (
93- block =
94- this. as_operand( block, scope, arg, LocalInfo :: Boring , NeedsTemporary :: No )
95- ) ;
79+ let arg = this
80+ . as_operand ( block, scope, arg, LocalInfo :: Boring , NeedsTemporary :: No )
81+ . unpack ( & mut block) ;
9682 // Check for -MIN on signed integers
9783 if this. check_overflow && op == UnOp :: Neg && expr. ty . is_signed ( ) {
9884 let bool_ty = this. tcx . types . bool ;
@@ -200,7 +186,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
200186 && adt_def. is_enum ( )
201187 {
202188 let discr_ty = adt_def. repr ( ) . discr_type ( ) . to_ty ( this. tcx ) ;
203- let temp = unpack ! ( block = this. as_temp( block, scope, source, Mutability :: Not ) ) ;
189+ let temp =
190+ this. as_temp ( block, scope, source, Mutability :: Not ) . unpack ( & mut block) ;
204191 let layout = this. tcx . layout_of ( this. param_env . and ( source_expr. ty ) ) ;
205192 let discr = this. temp ( discr_ty, source_expr. span ) ;
206193 this. cfg . push_assign (
@@ -282,15 +269,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
282269 ( op, ty)
283270 } else {
284271 let ty = source_expr. ty ;
285- let source = unpack ! (
286- block = this. as_operand(
287- block,
288- scope,
289- source,
290- LocalInfo :: Boring ,
291- NeedsTemporary :: No
292- )
293- ) ;
272+ let source = this
273+ . as_operand ( block, scope, source, LocalInfo :: Boring , NeedsTemporary :: No )
274+ . unpack ( & mut block) ;
294275 ( source, ty)
295276 } ;
296277 let from_ty = CastTy :: from_ty ( ty) ;
@@ -300,15 +281,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
300281 block. and ( Rvalue :: Cast ( cast_kind, source, expr. ty ) )
301282 }
302283 ExprKind :: PointerCoercion { cast, source } => {
303- let source = unpack ! (
304- block = this. as_operand(
305- block,
306- scope,
307- source,
308- LocalInfo :: Boring ,
309- NeedsTemporary :: No
310- )
311- ) ;
284+ let source = this
285+ . as_operand ( block, scope, source, LocalInfo :: Boring , NeedsTemporary :: No )
286+ . unpack ( & mut block) ;
312287 block. and ( Rvalue :: Cast ( CastKind :: PointerCoercion ( cast) , source, expr. ty ) )
313288 }
314289 ExprKind :: Array { ref fields } => {
@@ -344,15 +319,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
344319 . into_iter ( )
345320 . copied ( )
346321 . map ( |f| {
347- unpack ! (
348- block = this. as_operand(
349- block,
350- scope,
351- f,
352- LocalInfo :: Boring ,
353- NeedsTemporary :: Maybe
354- )
355- )
322+ this. as_operand ( block, scope, f, LocalInfo :: Boring , NeedsTemporary :: Maybe )
323+ . unpack ( & mut block)
356324 } )
357325 . collect ( ) ;
358326
@@ -365,15 +333,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
365333 . into_iter ( )
366334 . copied ( )
367335 . map ( |f| {
368- unpack ! (
369- block = this. as_operand(
370- block,
371- scope,
372- f,
373- LocalInfo :: Boring ,
374- NeedsTemporary :: Maybe
375- )
376- )
336+ this. as_operand ( block, scope, f, LocalInfo :: Boring , NeedsTemporary :: Maybe )
337+ . unpack ( & mut block)
377338 } )
378339 . collect ( ) ;
379340
@@ -401,7 +362,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
401362 // ```
402363 //
403364 for ( thir_place, cause, hir_id) in fake_reads. into_iter ( ) {
404- let place_builder = unpack ! ( block = this. as_place_builder( block, * thir_place) ) ;
365+ let place_builder =
366+ this. as_place_builder ( block, * thir_place) . unpack ( & mut block) ;
405367
406368 if let Some ( mir_place) = place_builder. try_to_place ( this) {
407369 this. cfg . push_fake_read (
@@ -429,7 +391,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
429391 // This occurs when capturing by copy/move, while
430392 // by reference captures use as_operand
431393 Some ( Category :: Place ) => {
432- let place = unpack ! ( block = this. as_place( block, upvar) ) ;
394+ let place = this. as_place ( block, upvar) . unpack ( & mut block ) ;
433395 this. consume_by_copy_or_move ( place)
434396 }
435397 _ => {
@@ -442,26 +404,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
442404 borrow_kind :
443405 BorrowKind :: Mut { kind : MutBorrowKind :: Default } ,
444406 arg,
445- } => unpack ! (
446- block = this . limit_capture_mutability(
407+ } => this
408+ . limit_capture_mutability (
447409 upvar_expr. span ,
448410 upvar_expr. ty ,
449411 scope,
450412 block,
451413 arg,
452414 )
453- ) ,
454- _ => {
455- unpack ! (
456- block = this. as_operand(
457- block,
458- scope,
459- upvar,
460- LocalInfo :: Boring ,
461- NeedsTemporary :: Maybe
462- )
415+ . unpack ( & mut block) ,
416+ _ => this
417+ . as_operand (
418+ block,
419+ scope,
420+ upvar,
421+ LocalInfo :: Boring ,
422+ NeedsTemporary :: Maybe ,
463423 )
464- }
424+ . unpack ( & mut block ) ,
465425 }
466426 }
467427 }
@@ -536,15 +496,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
536496 Category :: of( & expr. kind) ,
537497 Some ( Category :: Rvalue ( RvalueFunc :: AsRvalue ) | Category :: Constant )
538498 ) ) ;
539- let operand = unpack ! (
540- block = this. as_operand(
541- block,
542- scope,
543- expr_id,
544- LocalInfo :: Boring ,
545- NeedsTemporary :: No ,
546- )
547- ) ;
499+ let operand = this
500+ . as_operand ( block, scope, expr_id, LocalInfo :: Boring , NeedsTemporary :: No )
501+ . unpack ( & mut block) ;
548502 block. and ( Rvalue :: Use ( operand) )
549503 }
550504 }
@@ -716,9 +670,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
716670 // Repeating a const does nothing
717671 } else {
718672 // For a non-const, we may need to generate an appropriate `Drop`
719- let value_operand = unpack ! (
720- block = this . as_operand( block, scope, value, LocalInfo :: Boring , NeedsTemporary :: No )
721- ) ;
673+ let value_operand = this
674+ . as_operand ( block, scope, value, LocalInfo :: Boring , NeedsTemporary :: No )
675+ . unpack ( & mut block ) ;
722676 if let Operand :: Move ( to_drop) = value_operand {
723677 let success = this. cfg . start_new_block ( ) ;
724678 this. cfg . terminate (
@@ -754,7 +708,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
754708
755709 this. cfg . push ( block, Statement { source_info, kind : StatementKind :: StorageLive ( temp) } ) ;
756710
757- let arg_place_builder = unpack ! ( block = this. as_place_builder( block, arg) ) ;
711+ let arg_place_builder = this. as_place_builder ( block, arg) . unpack ( & mut block ) ;
758712
759713 let mutability = match arg_place_builder. base ( ) {
760714 // We are capturing a path that starts off a local variable in the parent.
0 commit comments