Skip to content

Commit 5927eca

Browse files
committed
perf: Do not recursively replace aliases in predicates
We used to do so with `AliasRelate` goals when replacing aliases
1 parent 2b9bbbd commit 5927eca

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

  • compiler/rustc_next_trait_solver/src/solve/eval_ctxt

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,17 @@ where
944944
self.delegate.cx()
945945
}
946946

947+
pub(super) fn add_goal(&mut self, source: GoalSource, goal: Goal<I, I::Predicate>) {
948+
self.add_goal_raw(source, goal, true);
949+
}
950+
947951
#[instrument(level = "debug", skip(self))]
948-
pub(super) fn add_goal(&mut self, source: GoalSource, mut goal: Goal<I, I::Predicate>) {
952+
fn add_goal_raw(
953+
&mut self,
954+
source: GoalSource,
955+
mut goal: Goal<I, I::Predicate>,
956+
replace_alias: bool,
957+
) {
949958
goal.predicate = self.replace_alias_with_infer(goal.predicate, source, goal.param_env);
950959
self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
951960
self.nested_goals.push((source, goal, None));
@@ -1726,9 +1735,10 @@ where
17261735
projection_term: alias.into(),
17271736
term: infer_ty.into(),
17281737
};
1729-
self.ecx.add_goal(
1738+
self.ecx.add_goal_raw(
17301739
self.normalization_goal_source,
17311740
Goal::new(self.cx(), self.param_env, projection),
1741+
false,
17321742
);
17331743
infer_ty
17341744
}
@@ -1754,9 +1764,10 @@ where
17541764
projection_term: ty::AliasTerm::from_unevaluated_const(self.cx(), uc),
17551765
term: infer_ct.into(),
17561766
};
1757-
self.ecx.add_goal(
1767+
self.ecx.add_goal_raw(
17581768
self.normalization_goal_source,
17591769
Goal::new(self.cx(), self.param_env, projection),
1770+
false,
17601771
);
17611772
infer_ct
17621773
}

0 commit comments

Comments
 (0)