@@ -37,6 +37,14 @@ const DETECTOR_SNAPSHOT_PERIOD: isize = 256;
3737
3838/// Warning: do not use this function if you expect to start interpreting the given `Mir`. 
3939/// The `EvalContext` is only meant to be used to query values from constants and statics. 
40+ /// 
41+ /// This function is used during const propagation. We cannot use `mk_eval_cx`, because copy 
42+ /// propagation happens *during* the computation of the MIR of the current function. So if we 
43+ /// tried to call the `optimized_mir` query, we'd get a cycle error because we are (transitively) 
44+ /// inside the `optimized_mir` query of the `Instance` given. 
45+ /// 
46+ /// Since we are looking at the MIR of the function in an abstract manner, we don't have a 
47+ /// `ParamEnv` available to us. This function creates a `ParamEnv` for the given instance. 
4048pub  fn  mk_borrowck_eval_cx < ' a ,  ' mir ,  ' tcx > ( 
4149 tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
4250 instance :  Instance < ' tcx > , 
@@ -78,6 +86,11 @@ fn mk_eval_cx_inner<'a, 'mir, 'tcx>(
7886/// Warning: do not use this function if you expect to start interpreting the given `Mir`. 
7987/// The `EvalContext` is only meant to be used to do field and index projections into constants for 
8088/// `simd_shuffle` and const patterns in match arms. 
89+ /// 
90+ /// The function containing the `match` that is currently being analyzed may have generic bounds 
91+ /// that inform us about the generic bounds of the constant. E.g. using an associated constant 
92+ /// of a function's generic parameter will require knowledge about the bounds on the generic 
93+ /// parameter. 
8194fn  mk_eval_cx < ' a ,  ' tcx > ( 
8295 tcx :  TyCtxt < ' a ,  ' tcx ,  ' tcx > , 
8396 instance :  Instance < ' tcx > , 
0 commit comments