@@ -24,7 +24,7 @@ pub fn mk_borrowck_eval_cx<'a, 'mir, 'tcx>(
24
24
) -> EvalResult < ' tcx , EvalContext < ' a , ' mir , ' tcx , CompileTimeEvaluator > > {
25
25
debug ! ( "mk_borrowck_eval_cx: {:?}" , instance) ;
26
26
let param_env = tcx. param_env ( instance. def_id ( ) ) ;
27
- let mut ecx = EvalContext :: new ( tcx, param_env, CompileTimeEvaluator , ( ) ) ;
27
+ let mut ecx = EvalContext :: new ( tcx, param_env, CompileTimeEvaluator , ( ) , span ) ;
28
28
// insert a stack frame so any queries have the correct substs
29
29
ecx. push_stack_frame (
30
30
instance,
@@ -42,7 +42,8 @@ pub fn mk_eval_cx<'a, 'tcx>(
42
42
param_env : ty:: ParamEnv < ' tcx > ,
43
43
) -> EvalResult < ' tcx , EvalContext < ' a , ' tcx , ' tcx , CompileTimeEvaluator > > {
44
44
debug ! ( "mk_eval_cx: {:?}, {:?}" , instance, param_env) ;
45
- let mut ecx = EvalContext :: new ( tcx, param_env, CompileTimeEvaluator , ( ) ) ;
45
+ let span = tcx. def_span ( instance. def_id ( ) ) ;
46
+ let mut ecx = EvalContext :: new ( tcx, param_env, CompileTimeEvaluator , ( ) , span) ;
46
47
let mir = ecx. load_mir ( instance. def ) ?;
47
48
// insert a stack frame so any queries have the correct substs
48
49
ecx. push_stack_frame (
@@ -93,10 +94,10 @@ fn eval_body_and_ecx<'a, 'mir, 'tcx>(
93
94
param_env : ty:: ParamEnv < ' tcx > ,
94
95
) -> ( EvalResult < ' tcx , ( Value , Pointer , Ty < ' tcx > ) > , EvalContext < ' a , ' mir , ' tcx , CompileTimeEvaluator > ) {
95
96
debug ! ( "eval_body: {:?}, {:?}" , cid, param_env) ;
96
- let mut ecx = EvalContext :: new ( tcx, param_env, CompileTimeEvaluator , ( ) ) ;
97
97
// we start out with the best span we have
98
98
// and try improving it down the road when more information is available
99
99
let mut span = tcx. def_span ( cid. instance . def_id ( ) ) ;
100
+ let mut ecx = EvalContext :: new ( tcx, param_env, CompileTimeEvaluator , ( ) , mir. map ( |mir| mir. span ) . unwrap_or ( span) ) ;
100
101
let res = ( || {
101
102
let mut mir = match mir {
102
103
Some ( mir) => mir,
0 commit comments