@@ -30,31 +30,31 @@ pub struct ConstProp;
3030impl MirPass for ConstProp {
3131 fn run_pass < ' a , ' tcx > ( & self ,
3232 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
33- source : MirSource ,
33+ source : MirSource < ' tcx > ,
3434 mir : & mut Mir < ' tcx > ) {
3535 // will be evaluated by miri and produce its errors there
3636 if source. promoted . is_some ( ) {
3737 return ;
3838 }
3939
4040 use rustc:: hir:: map:: blocks:: FnLikeNode ;
41- let node_id = tcx. hir ( ) . as_local_node_id ( source. def_id )
41+ let node_id = tcx. hir ( ) . as_local_node_id ( source. def_id ( ) )
4242 . expect ( "Non-local call to local provider is_const_fn" ) ;
4343
4444 let is_fn_like = FnLikeNode :: from_node ( tcx. hir ( ) . get ( node_id) ) . is_some ( ) ;
45- let is_assoc_const = match tcx. describe_def ( source. def_id ) {
45+ let is_assoc_const = match tcx. describe_def ( source. def_id ( ) ) {
4646 Some ( Def :: AssociatedConst ( _) ) => true ,
4747 _ => false ,
4848 } ;
4949
5050 // Only run const prop on functions, methods, closures and associated constants
5151 if !is_fn_like && !is_assoc_const {
5252 // skip anon_const/statics/consts because they'll be evaluated by miri anyway
53- trace ! ( "ConstProp skipped for {:?}" , source. def_id) ;
53+ trace ! ( "ConstProp skipped for {:?}" , source. def_id( ) ) ;
5454 return
5555 }
5656
57- trace ! ( "ConstProp starting for {:?}" , source. def_id) ;
57+ trace ! ( "ConstProp starting for {:?}" , source. def_id( ) ) ;
5858
5959 // FIXME(oli-obk, eddyb) Optimize locals (or even local paths) to hold
6060 // constants, instead of just checking for const-folding succeeding.
@@ -63,7 +63,7 @@ impl MirPass for ConstProp {
6363 let mut optimization_finder = ConstPropagator :: new ( mir, tcx, source) ;
6464 optimization_finder. visit_mir ( mir) ;
6565
66- trace ! ( "ConstProp done for {:?}" , source. def_id) ;
66+ trace ! ( "ConstProp done for {:?}" , source. def_id( ) ) ;
6767 }
6868}
6969
@@ -74,7 +74,7 @@ struct ConstPropagator<'a, 'mir, 'tcx:'a+'mir> {
7474 ecx : EvalContext < ' a , ' mir , ' tcx , CompileTimeInterpreter < ' a , ' mir , ' tcx > > ,
7575 mir : & ' mir Mir < ' tcx > ,
7676 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
77- source : MirSource ,
77+ source : MirSource < ' tcx > ,
7878 places : IndexVec < Local , Option < Const < ' tcx > > > ,
7979 can_const_prop : IndexVec < Local , bool > ,
8080 param_env : ParamEnv < ' tcx > ,
@@ -107,10 +107,10 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
107107 fn new (
108108 mir : & ' mir Mir < ' tcx > ,
109109 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
110- source : MirSource ,
110+ source : MirSource < ' tcx > ,
111111 ) -> ConstPropagator < ' a , ' mir , ' tcx > {
112- let param_env = tcx. param_env ( source. def_id ) ;
113- let ecx = mk_eval_cx ( tcx, tcx. def_span ( source. def_id ) , param_env) ;
112+ let param_env = tcx. param_env ( source. def_id ( ) ) ;
113+ let ecx = mk_eval_cx ( tcx, tcx. def_span ( source. def_id ( ) ) , param_env) ;
114114 ConstPropagator {
115115 ecx,
116116 mir,
@@ -284,13 +284,13 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
284284 _ => None ,
285285 } ,
286286 Place :: Promoted ( ref promoted) => {
287- let generics = self . tcx . generics_of ( self . source . def_id ) ;
287+ let generics = self . tcx . generics_of ( self . source . def_id ( ) ) ;
288288 if generics. requires_monomorphization ( self . tcx ) {
289289 // FIXME: can't handle code with generics
290290 return None ;
291291 }
292- let substs = Substs :: identity_for_item ( self . tcx , self . source . def_id ) ;
293- let instance = Instance :: new ( self . source . def_id , substs) ;
292+ let substs = Substs :: identity_for_item ( self . tcx , self . source . def_id ( ) ) ;
293+ let instance = Instance :: new ( self . source . def_id ( ) , substs) ;
294294 let cid = GlobalId {
295295 instance,
296296 promoted : Some ( promoted. 0 ) ,
@@ -358,10 +358,10 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
358358 ) ) )
359359 }
360360 Rvalue :: UnaryOp ( op, ref arg) => {
361- let def_id = if self . tcx . is_closure ( self . source . def_id ) {
362- self . tcx . closure_base_def_id ( self . source . def_id )
361+ let def_id = if self . tcx . is_closure ( self . source . def_id ( ) ) {
362+ self . tcx . closure_base_def_id ( self . source . def_id ( ) )
363363 } else {
364- self . source . def_id
364+ self . source . def_id ( )
365365 } ;
366366 let generics = self . tcx . generics_of ( def_id) ;
367367 if generics. requires_monomorphization ( self . tcx ) {
@@ -398,10 +398,10 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> {
398398 Rvalue :: BinaryOp ( op, ref left, ref right) => {
399399 trace ! ( "rvalue binop {:?} for {:?} and {:?}" , op, left, right) ;
400400 let right = self . eval_operand ( right, source_info) ?;
401- let def_id = if self . tcx . is_closure ( self . source . def_id ) {
402- self . tcx . closure_base_def_id ( self . source . def_id )
401+ let def_id = if self . tcx . is_closure ( self . source . def_id ( ) ) {
402+ self . tcx . closure_base_def_id ( self . source . def_id ( ) )
403403 } else {
404- self . source . def_id
404+ self . source . def_id ( )
405405 } ;
406406 let generics = self . tcx . generics_of ( def_id) ;
407407 if generics. requires_monomorphization ( self . tcx ) {
@@ -608,7 +608,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> {
608608 let node_id = self
609609 . tcx
610610 . hir ( )
611- . as_local_node_id ( self . source . def_id )
611+ . as_local_node_id ( self . source . def_id ( ) )
612612 . expect ( "some part of a failing const eval must be local" ) ;
613613 use rustc:: mir:: interpret:: EvalErrorKind :: * ;
614614 let msg = match msg {
0 commit comments