@@ -288,8 +288,6 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for ConstPropMachine {
288
288
}
289
289
}
290
290
291
- type Const < ' tcx > = OpTy < ' tcx > ;
292
-
293
291
/// Finds optimization opportunities on the MIR.
294
292
struct ConstPropagator < ' mir , ' tcx > {
295
293
ecx : InterpCx < ' mir , ' tcx , ConstPropMachine > ,
@@ -387,7 +385,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
387
385
}
388
386
}
389
387
390
- fn get_const ( & self , local : Local ) -> Option < Const < ' tcx > > {
388
+ fn get_const ( & self , local : Local ) -> Option < OpTy < ' tcx > > {
391
389
if local == RETURN_PLACE {
392
390
// Try to read the return place as an immediate so that if it is representable as a
393
391
// 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> {
466
464
r
467
465
}
468
466
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 > > {
474
468
self . ecx . tcx . span = c. span ;
475
469
476
470
// FIXME we need to revisit this for #67176
@@ -510,12 +504,12 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
510
504
}
511
505
}
512
506
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 > > {
514
508
trace ! ( "eval_place(place={:?})" , place) ;
515
509
self . use_ecx ( source_info, |this| this. ecx . eval_place_to_op ( place, None ) )
516
510
}
517
511
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 > > {
519
513
match * op {
520
514
Operand :: Constant ( ref c) => self . eval_constant ( c, source_info) ,
521
515
Operand :: Move ( ref place) | Operand :: Copy ( ref place) => {
@@ -664,7 +658,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
664
658
fn replace_with_const (
665
659
& mut self ,
666
660
rval : & mut Rvalue < ' tcx > ,
667
- value : Const < ' tcx > ,
661
+ value : OpTy < ' tcx > ,
668
662
source_info : SourceInfo ,
669
663
) {
670
664
trace ! ( "attepting to replace {:?} with {:?}" , rval, value) ;
0 commit comments