improve debug logging

This commit is contained in:
Lukas Markeffsky 2024-03-07 13:20:56 +01:00
parent 6bd970d585
commit db48b93454
2 changed files with 4 additions and 15 deletions

View File

@ -77,7 +77,7 @@ pub fn enter_forall<T, U>(&self, forall: ty::Binder<'tcx, T>, f: impl FnOnce(T)
// that name placeholders created in this function. Nested goals from type relations can // that name placeholders created in this function. Nested goals from type relations can
// also contain placeholders created by this function. // also contain placeholders created by this function.
let value = self.enter_forall_and_leak_universe(forall); let value = self.enter_forall_and_leak_universe(forall);
debug!("?value"); debug!(?value);
f(value) f(value)
} }

View File

@ -1419,6 +1419,7 @@ fn can_match_projection(
// returns if `cond` not occurring implies that `error` does not occur - i.e., that // returns if `cond` not occurring implies that `error` does not occur - i.e., that
// `error` occurring implies that `cond` occurs. // `error` occurring implies that `cond` occurs.
#[instrument(level = "debug", skip(self), ret)]
fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -> bool { fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -> bool {
if cond == error { if cond == error {
return true; return true;
@ -1428,25 +1429,13 @@ fn error_implies(&self, cond: ty::Predicate<'tcx>, error: ty::Predicate<'tcx>) -
self.enter_forall(error, |error| { self.enter_forall(error, |error| {
elaborate(self.tcx, std::iter::once(cond)) elaborate(self.tcx, std::iter::once(cond))
.filter_map(|implied| implied.to_opt_poly_trait_pred()) .filter_map(|implied| implied.to_opt_poly_trait_pred())
.any(|implied| { .any(|implied| self.can_match_trait(error, implied))
let is_implied = self.can_match_trait(error, implied);
if is_implied {
debug!("error_implies: {:?} -> {:?} -> {:?}", cond, error, implied);
}
is_implied
})
}) })
} else if let Some(error) = error.to_opt_poly_projection_pred() { } else if let Some(error) = error.to_opt_poly_projection_pred() {
self.enter_forall(error, |error| { self.enter_forall(error, |error| {
elaborate(self.tcx, std::iter::once(cond)) elaborate(self.tcx, std::iter::once(cond))
.filter_map(|implied| implied.to_opt_poly_projection_pred()) .filter_map(|implied| implied.to_opt_poly_projection_pred())
.any(|implied| { .any(|implied| self.can_match_projection(error, implied))
let is_implied = self.can_match_projection(error, implied);
if is_implied {
debug!("error_implies: {:?} -> {:?} -> {:?}", cond, error, implied);
}
is_implied
})
}) })
} else { } else {
false false