Skip to content

Commit

Permalink
solve: replace all debug with trace
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed May 12, 2024
1 parent 8b64adc commit 41ebd16
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 63 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_trait_selection/src/solve/alias_relate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_middle::traits::solve::{Certainty, Goal, QueryResult};
use rustc_middle::ty;

impl<'tcx> EvalCtxt<'_, 'tcx> {
#[instrument(level = "debug", skip(self), ret)]
#[instrument(level = "trace", skip(self), ret)]
pub(super) fn compute_alias_relate_goal(
&mut self,
goal: Goal<'tcx, (ty::Term<'tcx>, ty::Term<'tcx>, ty::AliasRelationDirection)>,
Expand Down Expand Up @@ -50,7 +50,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
self.try_evaluate_added_goals()?;
let lhs = self.resolve_vars_if_possible(lhs);
let rhs = self.resolve_vars_if_possible(rhs);
debug!(?lhs, ?rhs);
trace!(?lhs, ?rhs);

let variance = match direction {
ty::AliasRelationDirection::Equate => ty::Variance::Invariant,
Expand Down
24 changes: 12 additions & 12 deletions compiler/rustc_trait_selection/src/solve/assembly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
};

if normalized_self_ty.is_ty_var() {
debug!("self type has been normalized to infer");
trace!("self type has been normalized to infer");
return self.forced_ambiguity(MaybeCause::Ambiguity).into_iter().collect();
}

Expand Down Expand Up @@ -331,7 +331,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
.enter(|this| this.evaluate_added_goals_and_make_canonical_response(certainty))
}

#[instrument(level = "debug", skip_all)]
#[instrument(level = "trace", skip_all)]
fn assemble_non_blanket_impl_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand Down Expand Up @@ -447,7 +447,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}
}

#[instrument(level = "debug", skip_all)]
#[instrument(level = "trace", skip_all)]
fn assemble_blanket_impl_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand All @@ -470,7 +470,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}
}

#[instrument(level = "debug", skip_all)]
#[instrument(level = "trace", skip_all)]
fn assemble_builtin_impl_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand Down Expand Up @@ -544,7 +544,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}
}

#[instrument(level = "debug", skip_all)]
#[instrument(level = "trace", skip_all)]
fn assemble_param_env_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand All @@ -561,7 +561,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}
}

#[instrument(level = "debug", skip_all)]
#[instrument(level = "trace", skip_all)]
fn assemble_alias_bound_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand Down Expand Up @@ -665,7 +665,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
}
}

#[instrument(level = "debug", skip_all)]
#[instrument(level = "trace", skip_all)]
fn assemble_object_bound_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand Down Expand Up @@ -756,7 +756,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
///
/// To do so we add an ambiguous candidate in case such an unknown impl could
/// apply to the current goal.
#[instrument(level = "debug", skip_all)]
#[instrument(level = "trace", skip_all)]
fn assemble_coherence_unknowable_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand Down Expand Up @@ -785,7 +785,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
// FIXME(@lcnr): The current structure here makes me unhappy and feels ugly. idk how
// to improve this however. However, this should make it fairly straightforward to refine
// the filtering going forward, so it seems alright-ish for now.
#[instrument(level = "debug", skip(self, goal))]
#[instrument(level = "trace", skip(self, goal))]
fn discard_impls_shadowed_by_env<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
Expand Down Expand Up @@ -814,7 +814,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
Certainty::Yes => {
candidates.retain(|c| match c.source {
CandidateSource::Impl(_) | CandidateSource::BuiltinImpl(_) => {
debug!(?c, "discard impl candidate");
trace!(?c, "discard impl candidate");
false
}
CandidateSource::ParamEnv(_) | CandidateSource::AliasBound => true,
Expand All @@ -825,7 +825,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
// to be ambig and wait for inference constraints. See
// tests/ui/traits/next-solver/env-shadows-impls/ambig-env-no-shadow.rs
Certainty::Maybe(cause) => {
debug!(?cause, "force ambiguity");
trace!(?cause, "force ambiguity");
*candidates = self.forced_ambiguity(cause).into_iter().collect();
}
}
Expand All @@ -836,7 +836,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
/// If there are multiple ways to prove a trait or projection goal, we have
/// to somehow try to merge the candidates into one. If that fails, we return
/// ambiguity.
#[instrument(level = "debug", skip(self), ret)]
#[instrument(level = "trace", skip(self), ret)]
pub(super) fn merge_candidates(
&mut self,
candidates: Vec<Candidate<'tcx>>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::solve::EvalCtxt;
//
// For types with an "existential" binder, i.e. coroutine witnesses, we also
// instantiate the binder with placeholders eagerly.
#[instrument(level = "debug", skip(ecx), ret)]
#[instrument(level = "trace", skip(ecx), ret)]
pub(in crate::solve) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
ecx: &EvalCtxt<'_, 'tcx>,
ty: Ty<'tcx>,
Expand Down Expand Up @@ -96,7 +96,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_auto_trait<'tcx>(
}
}

#[instrument(level = "debug", skip(ecx), ret)]
#[instrument(level = "trace", skip(ecx), ret)]
pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
ecx: &EvalCtxt<'_, 'tcx>,
ty: Ty<'tcx>,
Expand Down Expand Up @@ -160,7 +160,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_sized_trait<'tcx>(
}
}

#[instrument(level = "debug", skip(ecx), ret)]
#[instrument(level = "trace", skip(ecx), ret)]
pub(in crate::solve) fn instantiate_constituent_tys_for_copy_clone_trait<'tcx>(
ecx: &EvalCtxt<'_, 'tcx>,
ty: Ty<'tcx>,
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
/// the values inferred while solving the instantiated goal.
/// - `external_constraints`: additional constraints which aren't expressible
/// using simple unification of inference variables.
#[instrument(level = "debug", skip(self), ret)]
#[instrument(level = "trace", skip(self), ret)]
pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
&mut self,
certainty: Certainty,
Expand Down Expand Up @@ -166,15 +166,15 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
/// external constraints do not need to record that opaque, since if it is
/// further constrained by inference, that will be passed back in the var
/// values.
#[instrument(level = "debug", skip(self), ret)]
#[instrument(level = "trace", skip(self), ret)]
fn compute_external_query_constraints(
&self,
normalization_nested_goals: NestedNormalizationGoals<'tcx>,
) -> Result<ExternalConstraintsData<'tcx>, NoSolution> {
// We only check for leaks from universes which were entered inside
// of the query.
self.infcx.leak_check(self.max_input_universe, None).map_err(|e| {
debug!(?e, "failed the leak check");
trace!(?e, "failed the leak check");
NoSolution
})?;

Expand Down Expand Up @@ -334,7 +334,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
/// whether an alias is rigid by using the trait solver. When instantiating a response
/// from the solver we assume that the solver correctly handled aliases and therefore
/// always relate them structurally here.
#[instrument(level = "debug", skip(infcx))]
#[instrument(level = "trace", skip(infcx))]
fn unify_query_var_values(
infcx: &InferCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
Expand Down Expand Up @@ -407,7 +407,7 @@ pub(in crate::solve) fn make_canonical_state<'tcx, T: TypeFoldable<TyCtxt<'tcx>>
/// This currently assumes that unifying the var values trivially succeeds.
/// Adding any inference constraints which weren't present when originally
/// computing the canonical query can result in bugs.
#[instrument(level = "debug", skip(infcx, span, param_env))]
#[instrument(level = "trace", skip(infcx, span, param_env))]
pub(in crate::solve) fn instantiate_canonical_state<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
infcx: &InferCtxt<'tcx>,
span: Span,
Expand Down
32 changes: 16 additions & 16 deletions compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<'tcx> InferCtxt<'tcx> {
///
/// Using this while inside of the solver is wrong as it uses a new
/// search graph which would break cycle detection.
#[instrument(level = "debug", skip(self))]
#[instrument(level = "trace", skip(self))]
fn evaluate_root_goal(
&self,
goal: Goal<'tcx, ty::Predicate<'tcx>>,
Expand Down Expand Up @@ -276,7 +276,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
/// Instead of calling this function directly, use either [EvalCtxt::evaluate_goal]
/// if you're inside of the solver or [InferCtxtEvalExt::evaluate_root_goal] if you're
/// outside of it.
#[instrument(level = "debug", skip(tcx, search_graph, goal_evaluation), ret)]
#[instrument(level = "trace", skip(tcx, search_graph, goal_evaluation), ret)]
fn evaluate_canonical_goal(
tcx: TyCtxt<'tcx>,
search_graph: &'a mut search_graph::SearchGraph<'tcx>,
Expand Down Expand Up @@ -458,21 +458,21 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
}
}

#[instrument(level = "debug", skip(self))]
#[instrument(level = "trace", skip(self))]
pub(super) fn add_normalizes_to_goal(&mut self, goal: Goal<'tcx, ty::NormalizesTo<'tcx>>) {
self.inspect.add_normalizes_to_goal(self.infcx, self.max_input_universe, goal);
self.nested_goals.normalizes_to_goals.push(goal);
}

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

// Recursively evaluates all the goals added to this `EvalCtxt` to completion, returning
// the certainty of all the goals.
#[instrument(level = "debug", skip(self))]
#[instrument(level = "trace", skip(self))]
pub(super) fn try_evaluate_added_goals(&mut self) -> Result<Certainty, NoSolution> {
self.inspect.start_evaluate_added_goals();
let mut response = Ok(Certainty::overflow(false));
Expand Down Expand Up @@ -526,7 +526,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
unconstrained_goal,
)?;
// Add the nested goals from normalization to our own nested goals.
debug!(?nested_goals);
trace!(?nested_goals);
goals.goals.extend(nested_goals);

// Finally, equate the goal's RHS with the unconstrained var.
Expand Down Expand Up @@ -622,7 +622,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
///
/// This is the case if the `term` does not occur in any other part of the predicate
/// and is able to name all other placeholder and inference variables.
#[instrument(level = "debug", skip(self), ret)]
#[instrument(level = "trace", skip(self), ret)]
pub(super) fn term_is_fully_unconstrained(
&self,
goal: Goal<'tcx, ty::NormalizesTo<'tcx>>,
Expand Down Expand Up @@ -718,7 +718,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
&& goal.param_env.visit_with(&mut visitor).is_continue()
}

#[instrument(level = "debug", skip(self, param_env), ret)]
#[instrument(level = "trace", skip(self, param_env), ret)]
pub(super) fn eq<T: ToTrace<'tcx>>(
&mut self,
param_env: ty::ParamEnv<'tcx>,
Expand All @@ -733,7 +733,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
})
.map_err(|e| {
debug!(?e, "failed to equate");
trace!(?e, "failed to equate");
NoSolution
})
}
Expand All @@ -743,7 +743,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
/// Normally we emit a nested `AliasRelate` when equating an inference
/// variable and an alias. This causes us to instead constrain the inference
/// variable to the alias without emitting a nested alias relate goals.
#[instrument(level = "debug", skip(self, param_env), ret)]
#[instrument(level = "trace", skip(self, param_env), ret)]
pub(super) fn relate_rigid_alias_non_alias(
&mut self,
param_env: ty::ParamEnv<'tcx>,
Expand Down Expand Up @@ -781,7 +781,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
/// This sohuld only be used when we're either instantiating a previously
/// unconstrained "return value" or when we're sure that all aliases in
/// the types are rigid.
#[instrument(level = "debug", skip(self, param_env), ret)]
#[instrument(level = "trace", skip(self, param_env), ret)]
pub(super) fn eq_structurally_relating_aliases<T: ToTrace<'tcx>>(
&mut self,
param_env: ty::ParamEnv<'tcx>,
Expand All @@ -798,7 +798,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
Ok(())
}

#[instrument(level = "debug", skip(self, param_env), ret)]
#[instrument(level = "trace", skip(self, param_env), ret)]
pub(super) fn sub<T: ToTrace<'tcx>>(
&mut self,
param_env: ty::ParamEnv<'tcx>,
Expand All @@ -813,12 +813,12 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
})
.map_err(|e| {
debug!(?e, "failed to subtype");
trace!(?e, "failed to subtype");
NoSolution
})
}

#[instrument(level = "debug", skip(self, param_env), ret)]
#[instrument(level = "trace", skip(self, param_env), ret)]
pub(super) fn relate<T: ToTrace<'tcx>>(
&mut self,
param_env: ty::ParamEnv<'tcx>,
Expand All @@ -834,7 +834,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
self.add_goals(GoalSource::Misc, obligations.into_iter().map(|o| o.into()));
})
.map_err(|e| {
debug!(?e, "failed to relate");
trace!(?e, "failed to relate");
NoSolution
})
}
Expand All @@ -859,7 +859,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
obligations.into_iter().map(|o| o.into()).collect()
})
.map_err(|e| {
debug!(?e, "failed to equate");
trace!(?e, "failed to equate");
NoSolution
})
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/solve/fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl<'tcx> FulfillmentCtxt<'tcx> {
}

impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
#[instrument(level = "debug", skip(self, infcx))]
#[instrument(level = "trace", skip(self, infcx))]
fn register_predicate_obligation(
&mut self,
infcx: &InferCtxt<'tcx>,
Expand Down
Loading

0 comments on commit 41ebd16

Please sign in to comment.