Skip to content

Commit f0bffce

Browse files
committed
self-review
1 parent 4689294 commit f0bffce

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

compiler/rustc_middle/src/traits/solve/inspect.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ pub enum CacheHit {
5050

5151
/// When evaluating the root goals we also store the
5252
/// original values for the `CanonicalVarValues` of the
53-
/// canonicalized goal to map any [CanonicalState]
54-
/// from the `InferCtxt` local to the solver query to
53+
/// canonicalized goal. We use this to map any [CanonicalState]
54+
/// from the local `InferCtxt` of the solver query to
5555
/// the `InferCtxt` of the caller.
5656
#[derive(Eq, PartialEq)]
5757
pub enum GoalEvaluationKind<'tcx> {
@@ -131,8 +131,8 @@ pub enum ProbeStep<'tcx> {
131131
}
132132

133133
/// What kind of probe we're in. In case the probe represents a candidate, or
134-
/// the final result - via [ProbeKind::Root] - we also store the result for
135-
/// the candidate.
134+
/// the final result of the current goal - via [ProbeKind::Root] - we also
135+
/// store the [QueryResult].
136136
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
137137
pub enum ProbeKind<'tcx> {
138138
/// The root inference context while proving a goal.

compiler/rustc_trait_selection/src/solve/inspect/analyse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
4848
}
4949

5050
/// Visit the nested goals of this candidate.
51-
///
51+
///
5252
/// FIXME(@lcnr): we have to slightly adapt this API
5353
/// to also use it to compute the most relevant goal
5454
/// for fulfillment errors. Will do that once we actually
@@ -189,7 +189,7 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> {
189189
infcx,
190190
depth,
191191
orig_values,
192-
goal: root.uncanonicalized_goal,
192+
goal: infcx.resolve_vars_if_possible(root.uncanonicalized_goal),
193193
evaluation: root,
194194
},
195195
inspect::GoalEvaluationKind::Nested { .. } => unreachable!(),

compiler/rustc_trait_selection/src/solve/inspect/build.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ use crate::solve::{self, inspect, EvalCtxt, GenerateProofTree};
1818
/// In case the current evaluation does not generate a proof
1919
/// tree, `state` is simply `None` and we avoid any work.
2020
///
21-
/// The possible states the solver is in are represented via
21+
/// The possible states of the solver are represented via
2222
/// variants of [DebugSolver]. For any nested computation we call
2323
/// `ProofTreeBuilder::new_nested_computation_kind` which
24-
/// creates a new `ProofTreeBuilder` using the corresponding
25-
/// [DebugSolver] variant to temporarily replace the current one.
26-
/// Once that nested computation is done,
24+
/// creates a new `ProofTreeBuilder` to temporarily replace the
25+
/// current one. Once that nested computation is done,
2726
/// `ProofTreeBuilder::nested_computation_kind` is called
2827
/// to add the finished nested evaluation to the parent.
2928
///

compiler/rustc_trait_selection/src/traits/coherence.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,11 @@ where
893893

894894
/// Compute the `intercrate_ambiguity_causes` for the new solver using
895895
/// "proof trees".
896+
///
897+
/// This is a bit scuffed but seems to be good enough, at least
898+
/// when looking at UI tests. Given that it is only used to improve
899+
/// diagnostics this is good enough. We can always improve it once there
900+
/// are test cases where it is currently not enough.
896901
fn compute_intercrate_ambiguity_causes<'tcx>(
897902
infcx: &InferCtxt<'tcx>,
898903
obligations: &[PredicateObligation<'tcx>],
@@ -976,7 +981,6 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a> {
976981
Err(()) => {}
977982
Ok(Ok(())) => warn!("expected an unknowable trait ref: {trait_ref:?}"),
978983
Ok(Err(conflict)) => {
979-
let trait_ref = infcx.resolve_vars_if_possible(trait_ref);
980984
if !trait_ref.references_error() {
981985
let self_ty = trait_ref.self_ty();
982986
let (trait_desc, self_desc) = with_no_trimmed_paths!({

0 commit comments

Comments
 (0)