Skip to content

Commit e1f70f7

Browse files
committed
[const-prop] Remove useless typedef
It's confusing because it conflicts with ty::Const and just isn't generally useful.
1 parent 1ce08f9 commit e1f70f7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/librustc_mir/transform/const_prop.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,6 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine {
288288
}
289289
}
290290

291-
type Const<'tcx> = OpTy<'tcx>;
292-
293291
/// Finds optimization opportunities on the MIR.
294292
struct ConstPropagator<'mir, 'tcx> {
295293
ecx: InterpCx<'mir, 'tcx, ConstPropMachine>,
@@ -387,7 +385,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
387385
}
388386
}
389387

390-
fn get_const(&self, local: Local) -> Option<Const<'tcx>> {
388+
fn get_const(&self, local: Local) -> Option<OpTy<'tcx>> {
391389
if local == RETURN_PLACE {
392390
// Try to read the return place as an immediate so that if it is representable as a
393391
// scalar, we can handle it as such, but otherwise, just return the value as is.
@@ -470,7 +468,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
470468
&mut self,
471469
c: &Constant<'tcx>,
472470
source_info: SourceInfo,
473-
) -> Option<Const<'tcx>> {
471+
) -> Option<OpTy<'tcx>> {
474472
self.ecx.tcx.span = c.span;
475473

476474
// FIXME we need to revisit this for #67176
@@ -510,12 +508,12 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
510508
}
511509
}
512510

513-
fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
511+
fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option<OpTy<'tcx>> {
514512
trace!("eval_place(place={:?})", place);
515513
self.use_ecx(source_info, |this| this.ecx.eval_place_to_op(place, None))
516514
}
517515

518-
fn eval_operand(&mut self, op: &Operand<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
516+
fn eval_operand(&mut self, op: &Operand<'tcx>, source_info: SourceInfo) -> Option<OpTy<'tcx>> {
519517
match *op {
520518
Operand::Constant(ref c) => self.eval_constant(c, source_info),
521519
Operand::Move(ref place) | Operand::Copy(ref place) => {
@@ -664,7 +662,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
664662
fn replace_with_const(
665663
&mut self,
666664
rval: &mut Rvalue<'tcx>,
667-
value: Const<'tcx>,
665+
value: OpTy<'tcx>,
668666
source_info: SourceInfo,
669667
) {
670668
trace!("attepting to replace {:?} with {:?}", rval, value);

0 commit comments

Comments
 (0)