@@ -60,39 +60,25 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
60
60
if Some ( 0 ) == count. try_eval_target_usize ( this. tcx , this. param_env ) {
61
61
this. build_zero_repeat ( block, value, scope, source_info)
62
62
} 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) ;
72
66
block. and ( Rvalue :: Repeat ( value_operand, count) )
73
67
}
74
68
}
75
69
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) ;
89
76
this. build_binary_op ( block, op, expr_span, expr. ty , lhs, rhs)
90
77
}
91
78
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) ;
96
82
// Check for -MIN on signed integers
97
83
if this. check_overflow && op == UnOp :: Neg && expr. ty . is_signed ( ) {
98
84
let bool_ty = this. tcx . types . bool ;
@@ -200,7 +186,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
200
186
&& adt_def. is_enum ( )
201
187
{
202
188
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) ;
204
191
let layout = this. tcx . layout_of ( this. param_env . and ( source_expr. ty ) ) ;
205
192
let discr = this. temp ( discr_ty, source_expr. span ) ;
206
193
this. cfg . push_assign (
@@ -282,15 +269,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
282
269
( op, ty)
283
270
} else {
284
271
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) ;
294
275
( source, ty)
295
276
} ;
296
277
let from_ty = CastTy :: from_ty ( ty) ;
@@ -300,15 +281,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
300
281
block. and ( Rvalue :: Cast ( cast_kind, source, expr. ty ) )
301
282
}
302
283
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) ;
312
287
block. and ( Rvalue :: Cast ( CastKind :: PointerCoercion ( cast) , source, expr. ty ) )
313
288
}
314
289
ExprKind :: Array { ref fields } => {
@@ -344,15 +319,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
344
319
. into_iter ( )
345
320
. copied ( )
346
321
. 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)
356
324
} )
357
325
. collect ( ) ;
358
326
@@ -365,15 +333,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
365
333
. into_iter ( )
366
334
. copied ( )
367
335
. 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)
377
338
} )
378
339
. collect ( ) ;
379
340
@@ -401,7 +362,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
401
362
// ```
402
363
//
403
364
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) ;
405
367
406
368
if let Some ( mir_place) = place_builder. try_to_place ( this) {
407
369
this. cfg . push_fake_read (
@@ -429,7 +391,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
429
391
// This occurs when capturing by copy/move, while
430
392
// by reference captures use as_operand
431
393
Some ( Category :: Place ) => {
432
- let place = unpack ! ( block = this. as_place( block, upvar) ) ;
394
+ let place = this. as_place ( block, upvar) . unpack ( & mut block ) ;
433
395
this. consume_by_copy_or_move ( place)
434
396
}
435
397
_ => {
@@ -442,26 +404,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
442
404
borrow_kind :
443
405
BorrowKind :: Mut { kind : MutBorrowKind :: Default } ,
444
406
arg,
445
- } => unpack ! (
446
- block = this . limit_capture_mutability(
407
+ } => this
408
+ . limit_capture_mutability (
447
409
upvar_expr. span ,
448
410
upvar_expr. ty ,
449
411
scope,
450
412
block,
451
413
arg,
452
414
)
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 ,
463
423
)
464
- }
424
+ . unpack ( & mut block ) ,
465
425
}
466
426
}
467
427
}
@@ -536,15 +496,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
536
496
Category :: of( & expr. kind) ,
537
497
Some ( Category :: Rvalue ( RvalueFunc :: AsRvalue ) | Category :: Constant )
538
498
) ) ;
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) ;
548
502
block. and ( Rvalue :: Use ( operand) )
549
503
}
550
504
}
@@ -716,9 +670,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
716
670
// Repeating a const does nothing
717
671
} else {
718
672
// 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 ) ;
722
676
if let Operand :: Move ( to_drop) = value_operand {
723
677
let success = this. cfg . start_new_block ( ) ;
724
678
this. cfg . terminate (
@@ -754,7 +708,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
754
708
755
709
this. cfg . push ( block, Statement { source_info, kind : StatementKind :: StorageLive ( temp) } ) ;
756
710
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 ) ;
758
712
759
713
let mutability = match arg_place_builder. base ( ) {
760
714
// We are capturing a path that starts off a local variable in the parent.
0 commit comments