Skip to content

Commit d0db6fe

Browse files
oli-obkfee1-dead
authored andcommitted
Some tracing for better debugging
1 parent 4c0f2d0 commit d0db6fe

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

compiler/rustc_trait_selection/src/traits/wf.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,12 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
295295
}
296296

297297
/// Pushes the obligations required for `trait_ref` to be WF into `self.out`.
298+
#[instrument(level = "debug", skip(self))]
298299
fn compute_trait_ref(&mut self, trait_ref: &ty::TraitRef<'tcx>, elaborate: Elaborate) {
299300
let tcx = self.infcx.tcx;
300301
let obligations = self.nominal_obligations(trait_ref.def_id, trait_ref.substs);
301302

302-
debug!("compute_trait_ref obligations {:?}", obligations);
303+
debug!(?obligations);
303304
let param_env = self.param_env;
304305
let depth = self.recursion_depth;
305306

@@ -699,12 +700,14 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
699700
}
700701
}
701702

703+
#[instrument(level = "trace", skip(self))]
702704
fn nominal_obligations(
703705
&mut self,
704706
def_id: DefId,
705707
substs: SubstsRef<'tcx>,
706708
) -> Vec<traits::PredicateObligation<'tcx>> {
707709
let predicates = self.infcx.tcx.predicates_of(def_id);
710+
trace!(?predicates);
708711
let mut origins = vec![def_id; predicates.predicates.len()];
709712
let mut head = predicates;
710713
while let Some(parent) = head.parent {
@@ -713,6 +716,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
713716
}
714717

715718
let predicates = predicates.instantiate(self.infcx.tcx, substs);
719+
trace!(?predicates, "instantiated");
716720
debug_assert_eq!(predicates.predicates.len(), origins.len());
717721

718722
iter::zip(iter::zip(predicates.predicates, predicates.spans), origins.into_iter().rev())

compiler/rustc_typeck/src/astconv/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
709709
///
710710
/// If the `projections` argument is `None`, then assoc type bindings like `Foo<T = X>`
711711
/// are disallowed. Otherwise, they are pushed onto the vector given.
712+
#[instrument(level = "debug", skip(self))]
712713
pub fn instantiate_mono_trait_ref(
713714
&self,
714715
trait_ref: &hir::TraitRef<'_>,

compiler/rustc_typeck/src/check/wfcheck.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,8 +1229,10 @@ fn check_impl<'tcx>(
12291229
// therefore don't need to be WF (the trait's `Self: Trait` predicate
12301230
// won't hold).
12311231
let trait_ref = tcx.impl_trait_ref(item.def_id).unwrap();
1232+
trace!(?trait_ref);
12321233
let trait_ref =
12331234
fcx.normalize_associated_types_in(ast_trait_ref.path.span, trait_ref);
1235+
trace!(?trait_ref, "normalized");
12341236
let obligations = traits::wf::trait_obligations(
12351237
fcx,
12361238
fcx.param_env,

compiler/rustc_typeck/src/collect.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,7 @@ fn infer_return_ty_for_fn_sig<'tcx>(
19851985
}
19861986
}
19871987

1988+
#[instrument(level = "debug", skip(tcx))]
19881989
fn impl_trait_ref(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::TraitRef<'_>> {
19891990
let icx = ItemCtxt::new(tcx, def_id);
19901991
match tcx.hir().expect_item(def_id.expect_local()).kind {

0 commit comments

Comments
 (0)