Fast path for processing some obligations in the new solver
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
use std::iter;
|
||||
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_type_ir::data_structures::HashSet;
|
||||
use rustc_type_ir::inherent::*;
|
||||
use rustc_type_ir::relate::solver_relating::RelateExt;
|
||||
use rustc_type_ir::{
|
||||
@@ -158,10 +159,12 @@ where
|
||||
self.compute_external_query_constraints(certainty, normalization_nested_goals);
|
||||
let (var_values, mut external_constraints) = (self.var_values, external_constraints)
|
||||
.fold_with(&mut EagerResolver::new(self.delegate));
|
||||
// Remove any trivial region constraints once we've resolved regions
|
||||
external_constraints
|
||||
.region_constraints
|
||||
.retain(|outlives| outlives.0.as_region().is_none_or(|re| re != outlives.1));
|
||||
|
||||
// Remove any trivial or duplicated region constraints once we've resolved regions
|
||||
let mut unique = HashSet::default();
|
||||
external_constraints.region_constraints.retain(|outlives| {
|
||||
outlives.0.as_region().is_none_or(|re| re != outlives.1) && unique.insert(*outlives)
|
||||
});
|
||||
|
||||
let canonical = Canonicalizer::canonicalize_response(
|
||||
self.delegate,
|
||||
|
||||
@@ -603,6 +603,14 @@ where
|
||||
// If this loop did not result in any progress, what's our final certainty.
|
||||
let mut unchanged_certainty = Some(Certainty::Yes);
|
||||
for (source, goal) in mem::take(&mut self.nested_goals) {
|
||||
if let Some(has_changed) = self.delegate.compute_goal_fast_path(goal, self.origin_span)
|
||||
{
|
||||
if matches!(has_changed, HasChanged::Yes) {
|
||||
unchanged_certainty = None;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// We treat normalizes-to goals specially here. In each iteration we take the
|
||||
// RHS of the projection, replace it with a fresh inference variable, and only
|
||||
// after evaluating that goal do we equate the fresh inference variable with the
|
||||
|
||||
Reference in New Issue
Block a user