1
Fork 0

add additional logging

This commit is contained in:
lcnr 2024-02-26 10:12:40 +01:00
parent dc00e8cdb6
commit eeeb9b4d31
3 changed files with 8 additions and 1 deletions

View file

@ -1516,6 +1516,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
/// In case there is still ambiguity, the returned type may be an inference /// In case there is still ambiguity, the returned type may be an inference
/// variable. This is different from `structurally_resolve_type` which errors /// variable. This is different from `structurally_resolve_type` which errors
/// in this case. /// in this case.
#[instrument(level = "debug", skip(self, sp), ret)]
pub fn try_structurally_resolve_type(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx> { pub fn try_structurally_resolve_type(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx> {
let ty = self.resolve_vars_with_obligations(ty); let ty = self.resolve_vars_with_obligations(ty);

View file

@ -777,6 +777,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
// FIXME(@lcnr): The current structure here makes me unhappy and feels ugly. idk how // 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 // to improve this however. However, this should make it fairly straightforward to refine
// the filtering going forward, so it seems alright-ish for now. // the filtering going forward, so it seems alright-ish for now.
#[instrument(level = "debug", skip(self, goal))]
fn discard_impls_shadowed_by_env<G: GoalKind<'tcx>>( fn discard_impls_shadowed_by_env<G: GoalKind<'tcx>>(
&mut self, &mut self,
goal: Goal<'tcx, G>, goal: Goal<'tcx, G>,
@ -799,7 +800,10 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
// This feels dangerous. // This feels dangerous.
Certainty::Yes => { Certainty::Yes => {
candidates.retain(|c| match c.source { candidates.retain(|c| match c.source {
CandidateSource::Impl(_) | CandidateSource::BuiltinImpl(_) => false, CandidateSource::Impl(_) | CandidateSource::BuiltinImpl(_) => {
debug!(?c, "discard impl candidate");
false
}
CandidateSource::ParamEnv(_) | CandidateSource::AliasBound => true, CandidateSource::ParamEnv(_) | CandidateSource::AliasBound => true,
}); });
} }
@ -807,6 +811,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
// to be ambig and wait for inference constraints. See // to be ambig and wait for inference constraints. See
// tests/ui/traits/next-solver/env-shadows-impls/ambig-env-no-shadow.rs // tests/ui/traits/next-solver/env-shadows-impls/ambig-env-no-shadow.rs
Certainty::Maybe(cause) => { Certainty::Maybe(cause) => {
debug!(?cause, "force ambiguity");
*candidates = self.forced_ambiguity(cause); *candidates = self.forced_ambiguity(cause);
} }
} }

View file

@ -267,6 +267,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
/// This function is necessary in nearly all cases before matching on a type. /// This function is necessary in nearly all cases before matching on a type.
/// Not doing so is likely to be incomplete and therefore unsound during /// Not doing so is likely to be incomplete and therefore unsound during
/// coherence. /// coherence.
#[instrument(level = "debug", skip(self, param_env), ret)]
fn structurally_normalize_ty( fn structurally_normalize_ty(
&mut self, &mut self,
param_env: ty::ParamEnv<'tcx>, param_env: ty::ParamEnv<'tcx>,