Skip to content

Commit 56cdc74

Browse files
authored
Rollup merge of rust-lang#107321 - lcnr:comment, r=compiler-errors
solver comments + remove `TyCtxt::evaluate_goal` from the `RustcContributor::explore` session yesterday. This also removes `TyCtxt::evaluate_goal` because to canonicalize you have to use an `InferCtxt` anyways at which point we should just always get people to use `evaluate_root_goal`. r? `@spastorino`
2 parents 76f440c + 727b987 commit 56cdc74

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

compiler/rustc_trait_selection/src/solve/mod.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,6 @@ type CanonicalResponse<'tcx> = Canonical<'tcx, Response<'tcx>>;
141141
/// solver, merge the two responses again.
142142
pub type QueryResult<'tcx> = Result<CanonicalResponse<'tcx>, NoSolution>;
143143

144-
pub trait TyCtxtExt<'tcx> {
145-
fn evaluate_goal(self, goal: CanonicalGoal<'tcx>) -> QueryResult<'tcx>;
146-
}
147-
148-
impl<'tcx> TyCtxtExt<'tcx> for TyCtxt<'tcx> {
149-
fn evaluate_goal(self, goal: CanonicalGoal<'tcx>) -> QueryResult<'tcx> {
150-
let mut search_graph = search_graph::SearchGraph::new(self);
151-
EvalCtxt::evaluate_canonical_goal(self, &mut search_graph, goal)
152-
}
153-
}
154-
155144
pub trait InferCtxtEvalExt<'tcx> {
156145
/// Evaluates a goal from **outside** of the trait solver.
157146
///
@@ -194,6 +183,15 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
194183
self.infcx.tcx
195184
}
196185

186+
/// The entry point of the solver.
187+
///
188+
/// This function deals with (coinductive) cycles, overflow, and caching
189+
/// and then calls [`EvalCtxt::compute_goal`] which contains the actual
190+
/// logic of the solver.
191+
///
192+
/// Instead of calling this function directly, use either [EvalCtxt::evaluate_goal]
193+
/// if you're inside of the solver or [InferCtxtEvalExt::evaluate_root_goal] if you're
194+
/// outside of it.
197195
#[instrument(level = "debug", skip(tcx, search_graph), ret)]
198196
fn evaluate_canonical_goal(
199197
tcx: TyCtxt<'tcx>,

compiler/rustc_trait_selection/src/solve/project_goals.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
2828
// To only compute normalization once for each projection we only
2929
// normalize if the expected term is an unconstrained inference variable.
3030
//
31-
// E.g. for `<T as Trait>::Assoc = u32` we recursively compute the goal
32-
// `exists<U> <T as Trait>::Assoc = U` and then take the resulting type for
31+
// E.g. for `<T as Trait>::Assoc == u32` we recursively compute the goal
32+
// `exists<U> <T as Trait>::Assoc == U` and then take the resulting type for
3333
// `U` and equate it with `u32`. This means that we don't need a separate
3434
// projection cache in the solver.
3535
if self.term_is_fully_unconstrained(goal) {

0 commit comments

Comments
 (0)