Skip to content

Commit 8179b2e

Browse files
committedMar 8, 2023
Remove useless parameter to operand_from_scalar.
1 parent d94ec30 commit 8179b2e

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed
 

‎compiler/rustc_mir_transform/src/const_prop.rs

+5-14
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
458458
scalar,
459459
)) = *value
460460
{
461-
*operand = self.operand_from_scalar(
462-
scalar,
463-
value.layout.ty,
464-
DUMMY_SP,
465-
);
461+
*operand = self.operand_from_scalar(scalar, value.layout.ty);
466462
}
467463
}
468464
}
@@ -587,9 +583,9 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
587583
}
588584

589585
/// Creates a new `Operand::Constant` from a `Scalar` value
590-
fn operand_from_scalar(&self, scalar: Scalar, ty: Ty<'tcx>, span: Span) -> Operand<'tcx> {
586+
fn operand_from_scalar(&self, scalar: Scalar, ty: Ty<'tcx>) -> Operand<'tcx> {
591587
Operand::Constant(Box::new(Constant {
592-
span,
588+
span: DUMMY_SP,
593589
user_ty: None,
594590
literal: ConstantKind::from_scalar(self.tcx, scalar, ty),
595591
}))
@@ -634,8 +630,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
634630
if let Some(Right(imm)) = imm {
635631
match *imm {
636632
interpret::Immediate::Scalar(scalar) => {
637-
*rval =
638-
Rvalue::Use(self.operand_from_scalar(scalar, value.layout.ty, DUMMY_SP));
633+
*rval = Rvalue::Use(self.operand_from_scalar(scalar, value.layout.ty));
639634
}
640635
Immediate::ScalarPair(..) => {
641636
// Found a value represented as a pair. For now only do const-prop if the type
@@ -933,11 +928,7 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> {
933928
&& self.should_const_prop(value)
934929
{
935930
trace!("assertion on {:?} should be {:?}", value, expected);
936-
*cond = self.operand_from_scalar(
937-
value_const,
938-
self.tcx.types.bool,
939-
DUMMY_SP,
940-
);
931+
*cond = self.operand_from_scalar(value_const, self.tcx.types.bool);
941932
}
942933
}
943934
TerminatorKind::SwitchInt { ref mut discr, .. } => {

0 commit comments

Comments
 (0)