2929//! (non-mutating) use of `SRC`. These restrictions are conservative and may be relaxed in the
3030//! future.
3131
32- use rustc:: hir;
3332use rustc:: mir:: { Constant , Local , LocalKind , Location , Place , Mir , Operand , Rvalue , StatementKind } ;
3433use rustc:: mir:: visit:: MutVisitor ;
3534use rustc:: ty:: TyCtxt ;
@@ -41,26 +40,8 @@ pub struct CopyPropagation;
4140impl MirPass for CopyPropagation {
4241 fn run_pass < ' a , ' tcx > ( & self ,
4342 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
44- source : MirSource ,
43+ _source : MirSource ,
4544 mir : & mut Mir < ' tcx > ) {
46- // Don't run on constant MIR, because trans might not be able to
47- // evaluate the modified MIR.
48- // FIXME(eddyb) Remove check after miri is merged.
49- let id = tcx. hir . as_local_node_id ( source. def_id ) . unwrap ( ) ;
50- match ( tcx. hir . body_owner_kind ( id) , source. promoted ) {
51- ( _, Some ( _) ) |
52- ( hir:: BodyOwnerKind :: Const , _) |
53- ( hir:: BodyOwnerKind :: Static ( _) , _) => return ,
54-
55- ( hir:: BodyOwnerKind :: Fn , _) => {
56- if tcx. is_const_fn ( source. def_id ) {
57- // Don't run on const functions, as, again, trans might not be able to evaluate
58- // the optimized IR.
59- return
60- }
61- }
62- }
63-
6445 // We only run when the MIR optimization level is > 1.
6546 // This avoids a slow pass, and messing up debug info.
6647 if tcx. sess . opts . debugging_opts . mir_opt_level <= 1 {
0 commit comments