78
78
79
79
nested_goals : NestedGoals < I > ,
80
80
81
+ pub ( super ) origin_span : I :: Span ,
82
+
81
83
// Has this `EvalCtxt` errored out with `NoSolution` in `try_evaluate_added_goals`?
82
84
//
83
85
// If so, then it can no longer be used to make a canonical query response,
@@ -134,6 +136,7 @@ pub trait SolverDelegateEvalExt: SolverDelegate {
134
136
& self ,
135
137
goal : Goal < Self :: Interner , <Self :: Interner as Interner >:: Predicate > ,
136
138
generate_proof_tree : GenerateProofTree ,
139
+ span : <Self :: Interner as Interner >:: Span ,
137
140
) -> (
138
141
Result < ( HasChanged , Certainty ) , NoSolution > ,
139
142
Option < inspect:: GoalEvaluation < Self :: Interner > > ,
@@ -174,8 +177,9 @@ where
174
177
& self ,
175
178
goal : Goal < I , I :: Predicate > ,
176
179
generate_proof_tree : GenerateProofTree ,
180
+ span : I :: Span ,
177
181
) -> ( Result < ( HasChanged , Certainty ) , NoSolution > , Option < inspect:: GoalEvaluation < I > > ) {
178
- EvalCtxt :: enter_root ( self , self . cx ( ) . recursion_limit ( ) , generate_proof_tree, |ecx| {
182
+ EvalCtxt :: enter_root ( self , self . cx ( ) . recursion_limit ( ) , generate_proof_tree, span , |ecx| {
179
183
ecx. evaluate_goal ( GoalEvaluationKind :: Root , GoalSource :: Misc , goal)
180
184
} )
181
185
}
@@ -186,7 +190,7 @@ where
186
190
goal : Goal < Self :: Interner , <Self :: Interner as Interner >:: Predicate > ,
187
191
) -> bool {
188
192
self . probe ( || {
189
- EvalCtxt :: enter_root ( self , root_depth, GenerateProofTree :: No , |ecx| {
193
+ EvalCtxt :: enter_root ( self , root_depth, GenerateProofTree :: No , I :: Span :: dummy ( ) , |ecx| {
190
194
ecx. evaluate_goal ( GoalEvaluationKind :: Root , GoalSource :: Misc , goal)
191
195
} )
192
196
. 0
@@ -203,9 +207,13 @@ where
203
207
Result < ( NestedNormalizationGoals < I > , HasChanged , Certainty ) , NoSolution > ,
204
208
Option < inspect:: GoalEvaluation < I > > ,
205
209
) {
206
- EvalCtxt :: enter_root ( self , self . cx ( ) . recursion_limit ( ) , generate_proof_tree, |ecx| {
207
- ecx. evaluate_goal_raw ( GoalEvaluationKind :: Root , GoalSource :: Misc , goal)
208
- } )
210
+ EvalCtxt :: enter_root (
211
+ self ,
212
+ self . cx ( ) . recursion_limit ( ) ,
213
+ generate_proof_tree,
214
+ I :: Span :: dummy ( ) ,
215
+ |ecx| ecx. evaluate_goal_raw ( GoalEvaluationKind :: Root , GoalSource :: Misc , goal) ,
216
+ )
209
217
}
210
218
}
211
219
@@ -229,6 +237,7 @@ where
229
237
delegate : & D ,
230
238
root_depth : usize ,
231
239
generate_proof_tree : GenerateProofTree ,
240
+ origin_span : I :: Span ,
232
241
f : impl FnOnce ( & mut EvalCtxt < ' _ , D > ) -> R ,
233
242
) -> ( R , Option < inspect:: GoalEvaluation < I > > ) {
234
243
let mut search_graph = SearchGraph :: new ( root_depth) ;
@@ -248,6 +257,7 @@ where
248
257
variables : Default :: default ( ) ,
249
258
var_values : CanonicalVarValues :: dummy ( ) ,
250
259
is_normalizes_to_goal : false ,
260
+ origin_span,
251
261
tainted : Ok ( ( ) ) ,
252
262
} ;
253
263
let result = f ( & mut ecx) ;
@@ -289,12 +299,13 @@ where
289
299
max_input_universe : canonical_input. canonical . max_universe ,
290
300
search_graph,
291
301
nested_goals : NestedGoals :: new ( ) ,
302
+ origin_span : I :: Span :: dummy ( ) ,
292
303
tainted : Ok ( ( ) ) ,
293
304
inspect : canonical_goal_evaluation. new_goal_evaluation_step ( var_values) ,
294
305
} ;
295
306
296
307
for & ( key, ty) in & input. predefined_opaques_in_body . opaque_types {
297
- ecx. delegate . inject_new_hidden_type_unchecked ( key, ty) ;
308
+ ecx. delegate . inject_new_hidden_type_unchecked ( key, ty, ecx . origin_span ) ;
298
309
}
299
310
300
311
if !ecx. nested_goals . is_empty ( ) {
@@ -822,8 +833,12 @@ where
822
833
let identity_args = self . fresh_args_for_item ( alias. def_id ) ;
823
834
let rigid_ctor = ty:: AliasTerm :: new_from_args ( cx, alias. def_id , identity_args) ;
824
835
let ctor_term = rigid_ctor. to_term ( cx) ;
825
- let obligations =
826
- self . delegate . eq_structurally_relating_aliases ( param_env, term, ctor_term) ?;
836
+ let obligations = self . delegate . eq_structurally_relating_aliases (
837
+ param_env,
838
+ term,
839
+ ctor_term,
840
+ self . origin_span ,
841
+ ) ?;
827
842
debug_assert ! ( obligations. is_empty( ) ) ;
828
843
self . relate ( param_env, alias, variance, rigid_ctor)
829
844
} else {
@@ -841,7 +856,12 @@ where
841
856
lhs : T ,
842
857
rhs : T ,
843
858
) -> Result < ( ) , NoSolution > {
844
- let result = self . delegate . eq_structurally_relating_aliases ( param_env, lhs, rhs) ?;
859
+ let result = self . delegate . eq_structurally_relating_aliases (
860
+ param_env,
861
+ lhs,
862
+ rhs,
863
+ self . origin_span ,
864
+ ) ?;
845
865
assert_eq ! ( result, vec![ ] ) ;
846
866
Ok ( ( ) )
847
867
}
@@ -864,7 +884,7 @@ where
864
884
variance : ty:: Variance ,
865
885
rhs : T ,
866
886
) -> Result < ( ) , NoSolution > {
867
- let goals = self . delegate . relate ( param_env, lhs, variance, rhs) ?;
887
+ let goals = self . delegate . relate ( param_env, lhs, variance, rhs, self . origin_span ) ?;
868
888
self . add_goals ( GoalSource :: Misc , goals) ;
869
889
Ok ( ( ) )
870
890
}
@@ -881,7 +901,7 @@ where
881
901
lhs : T ,
882
902
rhs : T ,
883
903
) -> Result < Vec < Goal < I , I :: Predicate > > , NoSolution > {
884
- Ok ( self . delegate . relate ( param_env, lhs, ty:: Variance :: Invariant , rhs) ?)
904
+ Ok ( self . delegate . relate ( param_env, lhs, ty:: Variance :: Invariant , rhs, self . origin_span ) ?)
885
905
}
886
906
887
907
pub ( super ) fn instantiate_binder_with_infer < T : TypeFoldable < I > + Copy > (
@@ -917,12 +937,12 @@ where
917
937
}
918
938
919
939
pub ( super ) fn register_ty_outlives ( & self , ty : I :: Ty , lt : I :: Region ) {
920
- self . delegate . register_ty_outlives ( ty, lt) ;
940
+ self . delegate . register_ty_outlives ( ty, lt, self . origin_span ) ;
921
941
}
922
942
923
943
pub ( super ) fn register_region_outlives ( & self , a : I :: Region , b : I :: Region ) {
924
944
// `b : a` ==> `a <= b`
925
- self . delegate . sub_regions ( b, a) ;
945
+ self . delegate . sub_regions ( b, a, self . origin_span ) ;
926
946
}
927
947
928
948
/// Computes the list of goals required for `arg` to be well-formed
0 commit comments