Skip to content

Commit 27885a9

Browse files
committed
Auto merge of rust-lang#82727 - oli-obk:shrinkmem, r=pnkfelix
Test the effect of shrinking the size of Rvalue by 16 bytes r? `@ghost`
2 parents 76c500e + 9a2362e commit 27885a9

File tree

29 files changed

+94
-66
lines changed

29 files changed

+94
-66
lines changed

compiler/rustc_codegen_cranelift/src/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,14 @@ fn codegen_stmt<'tcx>(
464464
let val = crate::constant::codegen_tls_ref(fx, def_id, lval.layout());
465465
lval.write_cvalue(fx, val);
466466
}
467-
Rvalue::BinaryOp(bin_op, ref lhs, ref rhs) => {
467+
Rvalue::BinaryOp(bin_op, box (ref lhs, ref rhs)) => {
468468
let lhs = codegen_operand(fx, lhs);
469469
let rhs = codegen_operand(fx, rhs);
470470

471471
let res = crate::num::codegen_binop(fx, bin_op, lhs, rhs);
472472
lval.write_cvalue(fx, res);
473473
}
474-
Rvalue::CheckedBinaryOp(bin_op, ref lhs, ref rhs) => {
474+
Rvalue::CheckedBinaryOp(bin_op, box (ref lhs, ref rhs)) => {
475475
let lhs = codegen_operand(fx, lhs);
476476
let rhs = codegen_operand(fx, rhs);
477477

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

+16-4
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,9 @@ pub struct Place<'tcx> {
16831683
pub projection: &'tcx List<PlaceElem<'tcx>>,
16841684
}
16851685

1686+
#[cfg(target_arch = "x86_64")]
1687+
static_assert_size!(Place<'_>, 16);
1688+
16861689
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
16871690
#[derive(TyEncodable, TyDecodable, HashStable)]
16881691
pub enum ProjectionElem<V, T> {
@@ -1981,6 +1984,9 @@ pub enum Operand<'tcx> {
19811984
Constant(Box<Constant<'tcx>>),
19821985
}
19831986

1987+
#[cfg(target_arch = "x86_64")]
1988+
static_assert_size!(Operand<'_>, 24);
1989+
19841990
impl<'tcx> Debug for Operand<'tcx> {
19851991
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
19861992
use self::Operand::*;
@@ -2096,8 +2102,8 @@ pub enum Rvalue<'tcx> {
20962102

20972103
Cast(CastKind, Operand<'tcx>, Ty<'tcx>),
20982104

2099-
BinaryOp(BinOp, Operand<'tcx>, Operand<'tcx>),
2100-
CheckedBinaryOp(BinOp, Operand<'tcx>, Operand<'tcx>),
2105+
BinaryOp(BinOp, Box<(Operand<'tcx>, Operand<'tcx>)>),
2106+
CheckedBinaryOp(BinOp, Box<(Operand<'tcx>, Operand<'tcx>)>),
21012107

21022108
NullaryOp(NullOp, Ty<'tcx>),
21032109
UnaryOp(UnOp, Operand<'tcx>),
@@ -2116,6 +2122,9 @@ pub enum Rvalue<'tcx> {
21162122
Aggregate(Box<AggregateKind<'tcx>>, Vec<Operand<'tcx>>),
21172123
}
21182124

2125+
#[cfg(target_arch = "x86_64")]
2126+
static_assert_size!(Rvalue<'_>, 40);
2127+
21192128
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
21202129
pub enum CastKind {
21212130
Misc,
@@ -2139,6 +2148,9 @@ pub enum AggregateKind<'tcx> {
21392148
Generator(DefId, SubstsRef<'tcx>, hir::Movability),
21402149
}
21412150

2151+
#[cfg(target_arch = "x86_64")]
2152+
static_assert_size!(AggregateKind<'_>, 48);
2153+
21422154
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
21432155
pub enum BinOp {
21442156
/// The `+` operator (addition)
@@ -2215,8 +2227,8 @@ impl<'tcx> Debug for Rvalue<'tcx> {
22152227
Cast(ref kind, ref place, ref ty) => {
22162228
write!(fmt, "{:?} as {:?} ({:?})", place, ty, kind)
22172229
}
2218-
BinaryOp(ref op, ref a, ref b) => write!(fmt, "{:?}({:?}, {:?})", op, a, b),
2219-
CheckedBinaryOp(ref op, ref a, ref b) => {
2230+
BinaryOp(ref op, box (ref a, ref b)) => write!(fmt, "{:?}({:?}, {:?})", op, a, b),
2231+
CheckedBinaryOp(ref op, box (ref a, ref b)) => {
22202232
write!(fmt, "Checked{:?}({:?}, {:?})", op, a, b)
22212233
}
22222234
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
@@ -687,8 +687,8 @@ macro_rules! make_mir_visitor {
687687
self.visit_ty(ty, TyContext::Location(location));
688688
}
689689

690-
Rvalue::BinaryOp(_bin_op, lhs, rhs)
691-
| Rvalue::CheckedBinaryOp(_bin_op, lhs, rhs) => {
690+
Rvalue::BinaryOp(_bin_op, box(lhs, rhs))
691+
| Rvalue::CheckedBinaryOp(_bin_op, box(lhs, rhs)) => {
692692
self.visit_operand(lhs, location);
693693
self.visit_operand(rhs, location);
694694
}

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

0 commit comments

Comments
 (0)