Skip to content

Commit cba48b8

Browse files
authored
Rollup merge of rust-lang#67682 - wesleywiser:remove_opty_const_typedef, r=Dylan-DPC
[const-prop] Remove useless typedef It's confusing because it conflicts with `ty::Const` and just isn't generally useful.
2 parents 6250d56 + a957f0d commit cba48b8

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/librustc_mir/transform/const_prop.rs

Lines changed: 5 additions & 11 deletions
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.
@@ -466,11 +464,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
466464
r
467465
}
468466

469-
fn eval_constant(
470-
&mut self,
471-
c: &Constant<'tcx>,
472-
source_info: SourceInfo,
473-
) -> Option<Const<'tcx>> {
467+
fn eval_constant(&mut self, c: &Constant<'tcx>, source_info: SourceInfo) -> Option<OpTy<'tcx>> {
474468
self.ecx.tcx.span = c.span;
475469

476470
// FIXME we need to revisit this for #67176
@@ -510,12 +504,12 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
510504
}
511505
}
512506

513-
fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
507+
fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option<OpTy<'tcx>> {
514508
trace!("eval_place(place={:?})", place);
515509
self.use_ecx(source_info, |this| this.ecx.eval_place_to_op(place, None))
516510
}
517511

518-
fn eval_operand(&mut self, op: &Operand<'tcx>, source_info: SourceInfo) -> Option<Const<'tcx>> {
512+
fn eval_operand(&mut self, op: &Operand<'tcx>, source_info: SourceInfo) -> Option<OpTy<'tcx>> {
519513
match *op {
520514
Operand::Constant(ref c) => self.eval_constant(c, source_info),
521515
Operand::Move(ref place) | Operand::Copy(ref place) => {
@@ -664,7 +658,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
664658
fn replace_with_const(
665659
&mut self,
666660
rval: &mut Rvalue<'tcx>,
667-
value: Const<'tcx>,
661+
value: OpTy<'tcx>,
668662
source_info: SourceInfo,
669663
) {
670664
trace!("attepting to replace {:?} with {:?}", rval, value);

0 commit comments

Comments
 (0)