Skip to content

Commit 9a2362e

Browse files
committed
Shrink the size of Rvalue by 16 bytes
1 parent f314813 commit 9a2362e

File tree

29 files changed

+83
-67
lines changed

29 files changed

+83
-67
lines changed

compiler/rustc_codegen_cranelift/src/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -494,14 +494,14 @@ fn codegen_stmt<'tcx>(
494494
let val = crate::constant::codegen_tls_ref(fx, def_id, lval.layout());
495495
lval.write_cvalue(fx, val);
496496
}
497-
Rvalue::BinaryOp(bin_op, ref lhs, ref rhs) => {
497+
Rvalue::BinaryOp(bin_op, box (ref lhs, ref rhs)) => {
498498
let lhs = codegen_operand(fx, lhs);
499499
let rhs = codegen_operand(fx, rhs);
500500

501501
let res = crate::num::codegen_binop(fx, bin_op, lhs, rhs);
502502
lval.write_cvalue(fx, res);
503503
}
504-
Rvalue::CheckedBinaryOp(bin_op, ref lhs, ref rhs) => {
504+
Rvalue::CheckedBinaryOp(bin_op, box (ref lhs, ref rhs)) => {
505505
let lhs = codegen_operand(fx, lhs);
506506
let rhs = codegen_operand(fx, rhs);
507507

compiler/rustc_codegen_cranelift/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
associated_type_bounds,
66
never_type,
77
try_blocks,
8+
box_patterns,
89
hash_drain_filter
910
)]
1011
#![warn(rust_2018_idioms)]

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
424424
(bx, operand)
425425
}
426426

427-
mir::Rvalue::BinaryOp(op, ref lhs, ref rhs) => {
427+
mir::Rvalue::BinaryOp(op, box (ref lhs, ref rhs)) => {
428428
let lhs = self.codegen_operand(&mut bx, lhs);
429429
let rhs = self.codegen_operand(&mut bx, rhs);
430430
let llresult = match (lhs.val, rhs.val) {
@@ -453,7 +453,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
453453
};
454454
(bx, operand)
455455
}
456-
mir::Rvalue::CheckedBinaryOp(op, ref lhs, ref rhs) => {
456+
mir::Rvalue::CheckedBinaryOp(op, box (ref lhs, ref rhs)) => {
457457
let lhs = self.codegen_operand(&mut bx, lhs);
458458
let rhs = self.codegen_operand(&mut bx, rhs);
459459
let result = self.codegen_scalar_checked_binop(

compiler/rustc_middle/src/mir/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2076,8 +2076,8 @@ pub enum Rvalue<'tcx> {
20762076

20772077
Cast(CastKind, Operand<'tcx>, Ty<'tcx>),
20782078

2079-
BinaryOp(BinOp, Operand<'tcx>, Operand<'tcx>),
2080-
CheckedBinaryOp(BinOp, Operand<'tcx>, Operand<'tcx>),
2079+
BinaryOp(BinOp, Box<(Operand<'tcx>, Operand<'tcx>)>),
2080+
CheckedBinaryOp(BinOp, Box<(Operand<'tcx>, Operand<'tcx>)>),
20812081

20822082
NullaryOp(NullOp, Ty<'tcx>),
20832083
UnaryOp(UnOp, Operand<'tcx>),
@@ -2097,7 +2097,7 @@ pub enum Rvalue<'tcx> {
20972097
}
20982098

20992099
#[cfg(target_arch = "x86_64")]
2100-
static_assert_size!(Rvalue<'_>, 56);
2100+
static_assert_size!(Rvalue<'_>, 40);
21012101

21022102
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
21032103
pub enum CastKind {
@@ -2201,8 +2201,8 @@ impl<'tcx> Debug for Rvalue<'tcx> {
22012201
Cast(ref kind, ref place, ref ty) => {
22022202
write!(fmt, "{:?} as {:?} ({:?})", place, ty, kind)
22032203
}
2204-
BinaryOp(ref op, ref a, ref b) => write!(fmt, "{:?}({:?}, {:?})", op, a, b),
2205-
CheckedBinaryOp(ref op, ref a, ref b) => {
2204+
BinaryOp(ref op, box (ref a, ref b)) => write!(fmt, "{:?}({:?}, {:?})", op, a, b),
2205+
CheckedBinaryOp(ref op, box (ref a, ref b)) => {
22062206
write!(fmt, "Checked{:?}({:?}, {:?})", op, a, b)
22072207
}
22082208
UnaryOp(ref op, ref a) => write!(fmt, "{:?}({:?})", op, a),

compiler/rustc_middle/src/mir/tcx.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,12 @@ impl<'tcx> Rvalue<'tcx> {
182182
}
183183
Rvalue::Len(..) => tcx.types.usize,
184184
Rvalue::Cast(.., ty) => ty,
185-
Rvalue::BinaryOp(op, ref lhs, ref rhs) => {
185+
Rvalue::BinaryOp(op, box (ref lhs, ref rhs)) => {
186186
let lhs_ty = lhs.ty(local_decls, tcx);
187187
let rhs_ty = rhs.ty(local_decls, tcx);
188188
op.ty(tcx, lhs_ty, rhs_ty)
189189
}
190-
Rvalue::CheckedBinaryOp(op, ref lhs, ref rhs) => {
190+
Rvalue::CheckedBinaryOp(op, box (ref lhs, ref rhs)) => {
191191
let lhs_ty = lhs.ty(local_decls, tcx);
192192
let rhs_ty = rhs.ty(local_decls, tcx);
193193
let ty = op.ty(tcx, lhs_ty, rhs_ty);

compiler/rustc_middle/src/mir/type_foldable.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,11 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
181181
AddressOf(mutability, place) => AddressOf(mutability, place.fold_with(folder)),
182182
Len(place) => Len(place.fold_with(folder)),
183183
Cast(kind, op, ty) => Cast(kind, op.fold_with(folder), ty.fold_with(folder)),
184-
BinaryOp(op, rhs, lhs) => BinaryOp(op, rhs.fold_with(folder), lhs.fold_with(folder)),
185-
CheckedBinaryOp(op, rhs, lhs) => {
186-
CheckedBinaryOp(op, rhs.fold_with(folder), lhs.fold_with(folder))
184+
BinaryOp(op, box (rhs, lhs)) => {
185+
BinaryOp(op, box (rhs.fold_with(folder), lhs.fold_with(folder)))
186+
}
187+
CheckedBinaryOp(op, box (rhs, lhs)) => {
188+
CheckedBinaryOp(op, box (rhs.fold_with(folder), lhs.fold_with(folder)))
187189
}
188190
UnaryOp(op, val) => UnaryOp(op, val.fold_with(folder)),
189191
Discriminant(place) => Discriminant(place.fold_with(folder)),
@@ -227,7 +229,7 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
227229
op.visit_with(visitor)?;
228230
ty.visit_with(visitor)
229231
}
230-
BinaryOp(_, ref rhs, ref lhs) | CheckedBinaryOp(_, ref rhs, ref lhs) => {
232+
BinaryOp(_, box (ref rhs, ref lhs)) | CheckedBinaryOp(_, box (ref rhs, ref lhs)) => {
231233
rhs.visit_with(visitor)?;
232234
lhs.visit_with(visitor)
233235
}

compiler/rustc_middle/src/mir/visit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,8 @@ macro_rules! make_mir_visitor {
685685
self.visit_ty(ty, TyContext::Location(location));
686686
}
687687

688-
Rvalue::BinaryOp(_bin_op, lhs, rhs)
689-
| Rvalue::CheckedBinaryOp(_bin_op, lhs, rhs) => {
688+
Rvalue::BinaryOp(_bin_op, box(lhs, rhs))
689+
| Rvalue::CheckedBinaryOp(_bin_op, box(lhs, rhs)) => {
690690
self.visit_operand(lhs, location);
691691
self.visit_operand(rhs, location);
692692
}

compiler/rustc_mir/src/borrow_check/invalidation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> {
326326
);
327327
}
328328

329-
Rvalue::BinaryOp(_bin_op, ref operand1, ref operand2)
330-
| Rvalue::CheckedBinaryOp(_bin_op, ref operand1, ref operand2) => {
329+
Rvalue::BinaryOp(_bin_op, box (ref operand1, ref operand2))
330+
| Rvalue::CheckedBinaryOp(_bin_op, box (ref operand1, ref operand2)) => {
331331
self.consume_operand(location, operand1);
332332
self.consume_operand(location, operand2);
333333
}

compiler/rustc_mir/src/borrow_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1316,8 +1316,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13161316
);
13171317
}
13181318

1319-
Rvalue::BinaryOp(_bin_op, ref operand1, ref operand2)
1320-
| Rvalue::CheckedBinaryOp(_bin_op, ref operand1, ref operand2) => {
1319+
Rvalue::BinaryOp(_bin_op, box (ref operand1, ref operand2))
1320+
| Rvalue::CheckedBinaryOp(_bin_op, box (ref operand1, ref operand2)) => {
13211321
self.consume_operand(location, (operand1, span), flow_state);
13221322
self.consume_operand(location, (operand2, span), flow_state);
13231323
}

compiler/rustc_mir/src/borrow_check/type_check/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2299,8 +2299,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22992299

23002300
Rvalue::BinaryOp(
23012301
BinOp::Eq | BinOp::Ne | BinOp::Lt | BinOp::Le | BinOp::Gt | BinOp::Ge,
2302-
left,
2303-
right,
2302+
box (left, right),
23042303
) => {
23052304
let ty_left = left.ty(body, tcx);
23062305
match ty_left.kind() {

compiler/rustc_mir/src/dataflow/move_paths/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
329329
| Rvalue::Repeat(ref operand, _)
330330
| Rvalue::Cast(_, ref operand, _)
331331
| Rvalue::UnaryOp(_, ref operand) => self.gather_operand(operand),
332-
Rvalue::BinaryOp(ref _binop, ref lhs, ref rhs)
333-
| Rvalue::CheckedBinaryOp(ref _binop, ref lhs, ref rhs) => {
332+
Rvalue::BinaryOp(ref _binop, box (ref lhs, ref rhs))
333+
| Rvalue::CheckedBinaryOp(ref _binop, box (ref lhs, ref rhs)) => {
334334
self.gather_operand(lhs);
335335
self.gather_operand(rhs);
336336
}

compiler/rustc_mir/src/interpret/step.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
165165
self.copy_op(&op, &dest)?;
166166
}
167167

168-
BinaryOp(bin_op, ref left, ref right) => {
168+
BinaryOp(bin_op, box (ref left, ref right)) => {
169169
let layout = binop_left_homogeneous(bin_op).then_some(dest.layout);
170170
let left = self.read_immediate(&self.eval_operand(left, layout)?)?;
171171
let layout = binop_right_homogeneous(bin_op).then_some(left.layout);
172172
let right = self.read_immediate(&self.eval_operand(right, layout)?)?;
173173
self.binop_ignore_overflow(bin_op, &left, &right, &dest)?;
174174
}
175175

176-
CheckedBinaryOp(bin_op, ref left, ref right) => {
176+
CheckedBinaryOp(bin_op, box (ref left, ref right)) => {
177177
// Due to the extra boolean in the result, we can never reuse the `dest.layout`.
178178
let left = self.read_immediate(&self.eval_operand(left, None)?)?;
179179
let layout = binop_right_homogeneous(bin_op).then_some(left.layout);

compiler/rustc_mir/src/shim.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ impl CloneShimBuilder<'tcx> {
463463
let cond = self.make_place(Mutability::Mut, tcx.types.bool);
464464
let compute_cond = self.make_statement(StatementKind::Assign(box (
465465
cond,
466-
Rvalue::BinaryOp(BinOp::Ne, Operand::Copy(end), Operand::Copy(beg)),
466+
Rvalue::BinaryOp(BinOp::Ne, box (Operand::Copy(end), Operand::Copy(beg))),
467467
)));
468468

469469
// `if end != beg { goto loop_body; } else { goto loop_end; }`
@@ -536,8 +536,7 @@ impl CloneShimBuilder<'tcx> {
536536
Place::from(beg),
537537
Rvalue::BinaryOp(
538538
BinOp::Add,
539-
Operand::Copy(Place::from(beg)),
540-
Operand::Constant(self.make_usize(1)),
539+
box (Operand::Copy(Place::from(beg)), Operand::Constant(self.make_usize(1))),
541540
),
542541
)))];
543542
self.block(statements, TerminatorKind::Goto { target: BasicBlock::new(1) }, false);
@@ -590,8 +589,7 @@ impl CloneShimBuilder<'tcx> {
590589
Place::from(beg),
591590
Rvalue::BinaryOp(
592591
BinOp::Add,
593-
Operand::Copy(Place::from(beg)),
594-
Operand::Constant(self.make_usize(1)),
592+
box (Operand::Copy(Place::from(beg)), Operand::Constant(self.make_usize(1))),
595593
),
596594
)));
597595
self.block(vec![statement], TerminatorKind::Goto { target: BasicBlock::new(6) }, true);

compiler/rustc_mir/src/transform/check_consts/qualifs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ where
168168
| Rvalue::UnaryOp(_, operand)
169169
| Rvalue::Cast(_, operand, _) => in_operand::<Q, _>(cx, in_local, operand),
170170

171-
Rvalue::BinaryOp(_, lhs, rhs) | Rvalue::CheckedBinaryOp(_, lhs, rhs) => {
171+
Rvalue::BinaryOp(_, box (lhs, rhs)) | Rvalue::CheckedBinaryOp(_, box (lhs, rhs)) => {
172172
in_operand::<Q, _>(cx, in_local, lhs) || in_operand::<Q, _>(cx, in_local, rhs)
173173
}
174174

compiler/rustc_mir/src/transform/check_consts/validation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,8 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
684684
}
685685
}
686686

687-
Rvalue::BinaryOp(op, ref lhs, ref rhs)
688-
| Rvalue::CheckedBinaryOp(op, ref lhs, ref rhs) => {
687+
Rvalue::BinaryOp(op, box (ref lhs, ref rhs))
688+
| Rvalue::CheckedBinaryOp(op, box (ref lhs, ref rhs)) => {
689689
let lhs_ty = lhs.ty(self.body, self.tcx);
690690
let rhs_ty = rhs.ty(self.body, self.tcx);
691691

compiler/rustc_mir/src/transform/const_prop.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
676676
trace!("checking UnaryOp(op = {:?}, arg = {:?})", op, arg);
677677
self.check_unary_op(*op, arg, source_info)?;
678678
}
679-
Rvalue::BinaryOp(op, left, right) => {
679+
Rvalue::BinaryOp(op, box (left, right)) => {
680680
trace!("checking BinaryOp(op = {:?}, left = {:?}, right = {:?})", op, left, right);
681681
self.check_binary_op(*op, left, right, source_info)?;
682682
}
683-
Rvalue::CheckedBinaryOp(op, left, right) => {
683+
Rvalue::CheckedBinaryOp(op, box (left, right)) => {
684684
trace!(
685685
"checking CheckedBinaryOp(op = {:?}, left = {:?}, right = {:?})",
686686
op,
@@ -740,7 +740,8 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
740740
) -> Option<()> {
741741
self.use_ecx(|this| {
742742
match rvalue {
743-
Rvalue::BinaryOp(op, left, right) | Rvalue::CheckedBinaryOp(op, left, right) => {
743+
Rvalue::BinaryOp(op, box (left, right))
744+
| Rvalue::CheckedBinaryOp(op, box (left, right)) => {
744745
let l = this.ecx.eval_operand(left, None);
745746
let r = this.ecx.eval_operand(right, None);
746747

@@ -772,7 +773,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
772773
}
773774
BinOp::Mul => {
774775
if const_arg.layout.ty.is_integral() && arg_value == 0 {
775-
if let Rvalue::CheckedBinaryOp(_, _, _) = rvalue {
776+
if let Rvalue::CheckedBinaryOp(_, _) = rvalue {
776777
let val = Immediate::ScalarPair(
777778
const_arg.to_scalar()?.into(),
778779
Scalar::from_bool(false).into(),

compiler/rustc_mir/src/transform/early_otherwise_branch.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
9191
opt_to_apply.infos[0].first_switch_info.discr_used_in_switch;
9292
let not_equal_rvalue = Rvalue::BinaryOp(
9393
not_equal,
94-
Operand::Copy(Place::from(second_discriminant_temp)),
95-
Operand::Copy(first_descriminant_place),
94+
box (
95+
Operand::Copy(Place::from(second_discriminant_temp)),
96+
Operand::Copy(first_descriminant_place),
97+
),
9698
);
9799
patch.add_statement(
98100
end_of_block_location,

compiler/rustc_mir/src/transform/instcombine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'tcx, 'a> InstCombineContext<'tcx, 'a> {
4444
/// Transform boolean comparisons into logical operations.
4545
fn combine_bool_cmp(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
4646
match rvalue {
47-
Rvalue::BinaryOp(op @ (BinOp::Eq | BinOp::Ne), a, b) => {
47+
Rvalue::BinaryOp(op @ (BinOp::Eq | BinOp::Ne), box (a, b)) => {
4848
let new = match (op, self.try_eval_bool(a), self.try_eval_bool(b)) {
4949
// Transform "Eq(a, true)" ==> "a"
5050
(BinOp::Eq, _, Some(true)) => Some(a.clone()),

compiler/rustc_mir/src/transform/lower_intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ impl<'tcx> MirPass<'tcx> for LowerIntrinsics {
5959
source_info: terminator.source_info,
6060
kind: StatementKind::Assign(box (
6161
destination,
62-
Rvalue::BinaryOp(bin_op, lhs, rhs),
62+
Rvalue::BinaryOp(bin_op, box (lhs, rhs)),
6363
)),
6464
});
6565
terminator.kind = TerminatorKind::Goto { target };

compiler/rustc_mir/src/transform/match_branches.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
139139
let op = if f_b { BinOp::Eq } else { BinOp::Ne };
140140
let rhs = Rvalue::BinaryOp(
141141
op,
142-
Operand::Copy(Place::from(discr_local)),
143-
const_cmp,
142+
box (Operand::Copy(Place::from(discr_local)), const_cmp),
144143
);
145144
Statement {
146145
source_info: f.source_info,

compiler/rustc_mir/src/transform/promote_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl<'tcx> Validator<'_, 'tcx> {
643643
self.validate_operand(operand)?;
644644
}
645645

646-
Rvalue::BinaryOp(op, lhs, rhs) | Rvalue::CheckedBinaryOp(op, lhs, rhs) => {
646+
Rvalue::BinaryOp(op, box (lhs, rhs)) | Rvalue::CheckedBinaryOp(op, box (lhs, rhs)) => {
647647
let op = *op;
648648
let lhs_ty = lhs.ty(self.body, self.tcx);
649649

compiler/rustc_mir/src/transform/simplify_comparison_integral.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ impl<'tcx> MirPass<'tcx> for SimplifyComparisonIntegral {
8484

8585
use Operand::*;
8686
match rhs {
87-
Rvalue::BinaryOp(_, ref mut left @ Move(_), Constant(_)) => {
87+
Rvalue::BinaryOp(_, box (ref mut left @ Move(_), Constant(_))) => {
8888
*left = Copy(opt.to_switch_on);
8989
}
90-
Rvalue::BinaryOp(_, Constant(_), ref mut right @ Move(_)) => {
90+
Rvalue::BinaryOp(_, box (Constant(_), ref mut right @ Move(_))) => {
9191
*right = Copy(opt.to_switch_on);
9292
}
9393
_ => (),
@@ -166,7 +166,10 @@ impl<'a, 'tcx> OptimizationFinder<'a, 'tcx> {
166166
if *lhs == place_switched_on =>
167167
{
168168
match rhs {
169-
Rvalue::BinaryOp(op @ (BinOp::Eq | BinOp::Ne), left, right) => {
169+
Rvalue::BinaryOp(
170+
op @ (BinOp::Eq | BinOp::Ne),
171+
box (left, right),
172+
) => {
170173
let (branch_value_scalar, branch_value_ty, to_switch_on) =
171174
find_branch_value_info(left, right)?;
172175

compiler/rustc_mir/src/util/elaborate_drops.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,14 @@ where
678678

679679
let one = self.constant_usize(1);
680680
let (ptr_next, cur_next) = if ptr_based {
681-
(Rvalue::Use(copy(cur.into())), Rvalue::BinaryOp(BinOp::Offset, move_(cur.into()), one))
681+
(
682+
Rvalue::Use(copy(cur.into())),
683+
Rvalue::BinaryOp(BinOp::Offset, box (move_(cur.into()), one)),
684+
)
682685
} else {
683686
(
684687
Rvalue::AddressOf(Mutability::Mut, tcx.mk_place_index(self.place, cur)),
685-
Rvalue::BinaryOp(BinOp::Add, move_(cur.into()), one),
688+
Rvalue::BinaryOp(BinOp::Add, box (move_(cur.into()), one)),
686689
)
687690
};
688691

@@ -700,7 +703,7 @@ where
700703
let loop_block = BasicBlockData {
701704
statements: vec![self.assign(
702705
can_go,
703-
Rvalue::BinaryOp(BinOp::Eq, copy(Place::from(cur)), copy(length_or_end)),
706+
Rvalue::BinaryOp(BinOp::Eq, box (copy(Place::from(cur)), copy(length_or_end))),
704707
)],
705708
is_cleanup: unwind.is_cleanup(),
706709
terminator: Some(Terminator {
@@ -816,7 +819,10 @@ where
816819
self.assign(cur, Rvalue::Cast(CastKind::Misc, Operand::Move(tmp), iter_ty)),
817820
self.assign(
818821
length_or_end,
819-
Rvalue::BinaryOp(BinOp::Offset, Operand::Copy(cur), Operand::Move(length)),
822+
Rvalue::BinaryOp(
823+
BinOp::Offset,
824+
box (Operand::Copy(cur), Operand::Move(length)),
825+
),
820826
),
821827
]
822828
} else {

compiler/rustc_mir_build/src/build/expr/as_place.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
667667
block,
668668
source_info,
669669
lt,
670-
Rvalue::BinaryOp(BinOp::Lt, Operand::Copy(Place::from(index)), Operand::Copy(len)),
670+
Rvalue::BinaryOp(
671+
BinOp::Lt,
672+
box (Operand::Copy(Place::from(index)), Operand::Copy(len)),
673+
),
671674
);
672675
let msg = BoundsCheck { len: Operand::Move(len), index: Operand::Copy(Place::from(index)) };
673676
// assert!(lt, "...")

0 commit comments

Comments
 (0)