Skip to content

Commit c66328f

Browse files
committed
structurally important functions to debug
1 parent 41ebd16 commit c66328f

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

compiler/rustc_trait_selection/src/solve/assembly/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
282282
};
283283

284284
if normalized_self_ty.is_ty_var() {
285-
trace!("self type has been normalized to infer");
285+
debug!("self type has been normalized to infer");
286286
return self.forced_ambiguity(MaybeCause::Ambiguity).into_iter().collect();
287287
}
288288

@@ -785,7 +785,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
785785
// FIXME(@lcnr): The current structure here makes me unhappy and feels ugly. idk how
786786
// to improve this however. However, this should make it fairly straightforward to refine
787787
// the filtering going forward, so it seems alright-ish for now.
788-
#[instrument(level = "trace", skip(self, goal))]
788+
#[instrument(level = "debug", skip(self, goal))]
789789
fn discard_impls_shadowed_by_env<G: GoalKind<'tcx>>(
790790
&mut self,
791791
goal: Goal<'tcx, G>,
@@ -814,7 +814,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
814814
Certainty::Yes => {
815815
candidates.retain(|c| match c.source {
816816
CandidateSource::Impl(_) | CandidateSource::BuiltinImpl(_) => {
817-
trace!(?c, "discard impl candidate");
817+
debug!(?c, "discard impl candidate");
818818
false
819819
}
820820
CandidateSource::ParamEnv(_) | CandidateSource::AliasBound => true,
@@ -825,7 +825,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
825825
// to be ambig and wait for inference constraints. See
826826
// tests/ui/traits/next-solver/env-shadows-impls/ambig-env-no-shadow.rs
827827
Certainty::Maybe(cause) => {
828-
trace!(?cause, "force ambiguity");
828+
debug!(?cause, "force ambiguity");
829829
*candidates = self.forced_ambiguity(cause).into_iter().collect();
830830
}
831831
}
@@ -836,7 +836,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
836836
/// If there are multiple ways to prove a trait or projection goal, we have
837837
/// to somehow try to merge the candidates into one. If that fails, we return
838838
/// ambiguity.
839-
#[instrument(level = "trace", skip(self), ret)]
839+
#[instrument(level = "debug", skip(self), ret)]
840840
pub(super) fn merge_candidates(
841841
&mut self,
842842
candidates: Vec<Candidate<'tcx>>,

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ impl<'tcx> InferCtxt<'tcx> {
137137
///
138138
/// Using this while inside of the solver is wrong as it uses a new
139139
/// search graph which would break cycle detection.
140-
#[instrument(level = "trace", skip(self))]
140+
#[instrument(level = "debug", skip(self))]
141141
fn evaluate_root_goal(
142142
&self,
143143
goal: Goal<'tcx, ty::Predicate<'tcx>>,
@@ -276,7 +276,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
276276
/// Instead of calling this function directly, use either [EvalCtxt::evaluate_goal]
277277
/// if you're inside of the solver or [InferCtxtEvalExt::evaluate_root_goal] if you're
278278
/// outside of it.
279-
#[instrument(level = "trace", skip(tcx, search_graph, goal_evaluation), ret)]
279+
#[instrument(level = "debug", skip(tcx, search_graph, goal_evaluation), ret)]
280280
fn evaluate_canonical_goal(
281281
tcx: TyCtxt<'tcx>,
282282
search_graph: &'a mut search_graph::SearchGraph<'tcx>,
@@ -464,7 +464,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
464464
self.nested_goals.normalizes_to_goals.push(goal);
465465
}
466466

467-
#[instrument(level = "trace", skip(self))]
467+
#[instrument(level = "debug", skip(self))]
468468
pub(super) fn add_goal(&mut self, source: GoalSource, goal: Goal<'tcx, ty::Predicate<'tcx>>) {
469469
self.inspect.add_goal(self.infcx, self.max_input_universe, source, goal);
470470
self.nested_goals.goals.push((source, goal));

compiler/rustc_trait_selection/src/solve/eval_ctxt/probe.rs

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ impl<'tcx, F> TraitProbeCtxt<'_, '_, 'tcx, F>
5858
where
5959
F: FnOnce(&QueryResult<'tcx>) -> inspect::ProbeKind<'tcx>,
6060
{
61+
#[instrument(level = "debug", skip_all, fields(source = ?self.source))]
6162
pub(in crate::solve) fn enter(
6263
self,
6364
f: impl FnOnce(&mut EvalCtxt<'_, 'tcx>) -> QueryResult<'tcx>,

compiler/rustc_trait_selection/src/solve/search_graph.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ impl<'tcx> SearchGraph<'tcx> {
296296
}
297297

298298
self.on_cache_hit(reached_depth, encountered_overflow);
299+
debug!("global cache hit");
299300
return result;
300301
}
301302

@@ -315,6 +316,7 @@ impl<'tcx> SearchGraph<'tcx> {
315316
.filter(|p| !Self::stack_coinductive_from(tcx, &self.stack, p.head))
316317
})
317318
{
319+
debug!("provisional cache hit");
318320
// We have a nested goal which is already in the provisional cache, use
319321
// its result. We do not provide any usage kind as that should have been
320322
// already set correctly while computing the cache entry.
@@ -328,7 +330,7 @@ impl<'tcx> SearchGraph<'tcx> {
328330
);
329331
return entry.result;
330332
} else if let Some(stack_depth) = cache_entry.stack_depth {
331-
trace!("encountered cycle with depth {stack_depth:?}");
333+
debug!("encountered cycle with depth {stack_depth:?}");
332334
// We have a nested goal which directly relies on a goal deeper in the stack.
333335
//
334336
// We start by tagging all cycle participants, as that's necessary for caching.
@@ -436,7 +438,7 @@ impl<'tcx> SearchGraph<'tcx> {
436438
}
437439
}
438440

439-
trace!("canonical cycle overflow");
441+
debug!("canonical cycle overflow");
440442
let current_entry = self.pop_stack();
441443
debug_assert!(current_entry.has_been_used.is_empty());
442444
let result = Self::response_no_constraints(tcx, input, Certainty::overflow(false));

0 commit comments

Comments
 (0)