@@ -35,6 +35,8 @@ const STEPS_UNTIL_DETECTOR_ENABLED: isize = 1_000_000;
3535/// Should be a power of two for performance reasons. 
3636const  DETECTOR_SNAPSHOT_PERIOD :  isize  = 256 ; 
3737
38+ /// Warning: do not use this function if you expect to start interpreting the given `Mir`. 
39+ /// The `EvalContext` is only meant to be used to query values from constants and statics. 
3840pub  fn  mk_borrowck_eval_cx < ' a ,  ' mir ,  ' tcx > ( 
3941    tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
4042    instance :  Instance < ' tcx > , 
@@ -46,6 +48,8 @@ pub fn mk_borrowck_eval_cx<'a, 'mir, 'tcx>(
4648    mk_eval_cx_inner ( tcx,  instance,  mir,  span,  param_env) 
4749} 
4850
51+ /// This is just a helper function to reduce code duplication between `mk_borrowck_eval_cx` and 
52+ /// `mk_eval_cx`. Do not call this function directly. 
4953fn  mk_eval_cx_inner < ' a ,  ' mir ,  ' tcx > ( 
5054    tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
5155    instance :  Instance < ' tcx > , 
@@ -54,8 +58,9 @@ fn mk_eval_cx_inner<'a, 'mir, 'tcx>(
5458    param_env :  ty:: ParamEnv < ' tcx > , 
5559)  -> EvalResult < ' tcx ,  CompileTimeEvalContext < ' a ,  ' mir ,  ' tcx > >  { 
5660    let  mut  ecx = EvalContext :: new ( tcx. at ( span) ,  param_env,  CompileTimeInterpreter :: new ( ) ) ; 
57-     // insert a stack frame so any queries have the correct substs 
58-     // cannot use `push_stack_frame`; if we do `const_prop` explodes 
61+     // Insert a stack frame so any queries have the correct substs. 
62+     // We also avoid all the extra work performed by push_stack_frame, 
63+     // like initializing local variables 
5964    ecx. stack . push ( interpret:: Frame  { 
6065        block :  mir:: START_BLOCK , 
6166        locals :  IndexVec :: new ( ) , 
@@ -70,6 +75,9 @@ fn mk_eval_cx_inner<'a, 'mir, 'tcx>(
7075    Ok ( ecx) 
7176} 
7277
78+ /// Warning: do not use this function if you expect to start interpreting the given `Mir`. 
79+ /// The `EvalContext` is only meant to be used to do field and index projections into constants for 
80+ /// `simd_shuffle` and const patterns in match arms. 
7381fn  mk_eval_cx < ' a ,  ' tcx > ( 
7482    tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
7583    instance :  Instance < ' tcx > , 
0 commit comments