Pass spans around new solver
This commit is contained in:
parent
fd1110ce6a
commit
4e763c2297
16 changed files with 137 additions and 55 deletions
|
@ -145,9 +145,10 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
|
|||
fn instantiate_canonical_var_with_infer(
|
||||
&self,
|
||||
cv_info: CanonicalVarInfo<'tcx>,
|
||||
span: Span,
|
||||
universe_map: impl Fn(ty::UniverseIndex) -> ty::UniverseIndex,
|
||||
) -> ty::GenericArg<'tcx> {
|
||||
self.0.instantiate_canonical_var(DUMMY_SP, cv_info, universe_map)
|
||||
self.0.instantiate_canonical_var(span, cv_info, universe_map)
|
||||
}
|
||||
|
||||
fn insert_hidden_type(
|
||||
|
@ -173,11 +174,13 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
|
|||
self.0.add_item_bounds_for_hidden_type(def_id, args, param_env, hidden_ty, goals);
|
||||
}
|
||||
|
||||
fn inject_new_hidden_type_unchecked(&self, key: ty::OpaqueTypeKey<'tcx>, hidden_ty: Ty<'tcx>) {
|
||||
self.0.inject_new_hidden_type_unchecked(key, ty::OpaqueHiddenType {
|
||||
ty: hidden_ty,
|
||||
span: DUMMY_SP,
|
||||
})
|
||||
fn inject_new_hidden_type_unchecked(
|
||||
&self,
|
||||
key: ty::OpaqueTypeKey<'tcx>,
|
||||
hidden_ty: Ty<'tcx>,
|
||||
span: Span,
|
||||
) {
|
||||
self.0.inject_new_hidden_type_unchecked(key, ty::OpaqueHiddenType { ty: hidden_ty, span })
|
||||
}
|
||||
|
||||
fn reset_opaque_types(&self) {
|
||||
|
|
|
@ -82,7 +82,7 @@ impl<'tcx> ObligationStorage<'tcx> {
|
|||
self.overflowed.extend(ExtractIf::new(&mut self.pending, |o| {
|
||||
let goal = o.clone().into();
|
||||
let result = <&SolverDelegate<'tcx>>::from(infcx)
|
||||
.evaluate_root_goal(goal, GenerateProofTree::No)
|
||||
.evaluate_root_goal(goal, GenerateProofTree::No, o.cause.span)
|
||||
.0;
|
||||
matches!(result, Ok((HasChanged::Yes, _)))
|
||||
}));
|
||||
|
@ -163,7 +163,7 @@ where
|
|||
for obligation in self.obligations.unstalled_for_select() {
|
||||
let goal = obligation.clone().into();
|
||||
let result = <&SolverDelegate<'tcx>>::from(infcx)
|
||||
.evaluate_root_goal(goal, GenerateProofTree::No)
|
||||
.evaluate_root_goal(goal, GenerateProofTree::No, obligation.cause.span)
|
||||
.0;
|
||||
self.inspect_evaluated_obligation(infcx, &obligation, &result);
|
||||
let (changed, certainty) = match result {
|
||||
|
|
|
@ -88,7 +88,11 @@ pub(super) fn fulfillment_error_for_stalled<'tcx>(
|
|||
) -> FulfillmentError<'tcx> {
|
||||
let (code, refine_obligation) = infcx.probe(|_| {
|
||||
match <&SolverDelegate<'tcx>>::from(infcx)
|
||||
.evaluate_root_goal(root_obligation.clone().into(), GenerateProofTree::No)
|
||||
.evaluate_root_goal(
|
||||
root_obligation.clone().into(),
|
||||
GenerateProofTree::No,
|
||||
root_obligation.cause.span,
|
||||
)
|
||||
.0
|
||||
{
|
||||
Ok((_, Certainty::Maybe(MaybeCause::Ambiguity))) => {
|
||||
|
|
|
@ -238,7 +238,7 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
|
|||
// constraints, we get an ICE if we already applied the constraints
|
||||
// from the chosen candidate.
|
||||
let proof_tree = infcx
|
||||
.probe(|_| infcx.evaluate_root_goal(goal, GenerateProofTree::Yes).1)
|
||||
.probe(|_| infcx.evaluate_root_goal(goal, GenerateProofTree::Yes, span).1)
|
||||
.unwrap();
|
||||
InspectGoal::new(infcx, self.goal.depth + 1, proof_tree, None, source)
|
||||
}
|
||||
|
@ -440,8 +440,11 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
depth: usize,
|
||||
visitor: &mut V,
|
||||
) -> V::Result {
|
||||
let (_, proof_tree) =
|
||||
<&SolverDelegate<'tcx>>::from(self).evaluate_root_goal(goal, GenerateProofTree::Yes);
|
||||
let (_, proof_tree) = <&SolverDelegate<'tcx>>::from(self).evaluate_root_goal(
|
||||
goal,
|
||||
GenerateProofTree::Yes,
|
||||
visitor.span(),
|
||||
);
|
||||
let proof_tree = proof_tree.unwrap();
|
||||
visitor.visit_goal(&InspectGoal::new(self, depth, proof_tree, None, GoalSource::Misc))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue