From bb6b433958cf1471f7df02f824a7112c2ef81792 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 4 May 2022 22:46:24 +0200 Subject: [PATCH] Add debug statements. --- compiler/rustc_trait_selection/src/traits/util.rs | 3 ++- compiler/rustc_typeck/src/astconv/mod.rs | 1 + compiler/rustc_typeck/src/collect.rs | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index 7543d1f9a7b..d101f69096f 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -118,13 +118,14 @@ fn expand(&mut self, item: &TraitAliasExpansionInfo<'tcx>) -> bool { // Get components of trait alias. let predicates = tcx.super_predicates_of(trait_ref.def_id()); + debug!(?predicates); let items = predicates.predicates.iter().rev().filter_map(|(pred, span)| { pred.subst_supertrait(tcx, &trait_ref) .to_opt_poly_trait_pred() .map(|trait_ref| item.clone_and_push(trait_ref.map_bound(|t| t.trait_ref), *span)) }); - debug!("expand_trait_aliases: items={:?}", items.clone()); + debug!("expand_trait_aliases: items={:?}", items.clone().collect::>()); self.stack.extend(items); diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index fd1b7bfa0b1..673a2c2fcaf 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -1070,6 +1070,7 @@ fn compute_bounds_inner( let mut bounds = Bounds::default(); self.add_bounds(param_ty, ast_bounds.iter(), &mut bounds, ty::List::empty()); + debug!(?bounds); bounds } diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index c1c63c46066..7a7e4a2f2b0 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -52,6 +52,7 @@ mod item_bounds; mod type_of; +#[derive(Debug)] struct OnlySelfBounds(bool); /////////////////////////////////////////////////////////////////////////// @@ -650,6 +651,7 @@ impl<'tcx> ItemCtxt<'tcx> { /// AST. We do this to avoid having to convert *all* the bounds, which /// would create artificial cycles. Instead, we can only convert the /// bounds for a type parameter `X` if `X::Foo` is used. + #[instrument(level = "trace", skip(self, ast_generics))] fn type_parameter_bounds_in_generics( &self, ast_generics: &'tcx hir::Generics<'tcx>, @@ -659,6 +661,7 @@ fn type_parameter_bounds_in_generics( assoc_name: Option, ) -> Vec<(ty::Predicate<'tcx>, Span)> { let param_def_id = self.tcx.hir().local_def_id(param_id).to_def_id(); + debug!(?param_def_id); ast_generics .predicates .iter() @@ -1140,6 +1143,7 @@ fn super_predicates_that_define_assoc_type( // Combine the two lists to form the complete set of superbounds: let superbounds = &*tcx.arena.alloc_from_iter(superbounds1.into_iter().chain(superbounds2)); + debug!(?superbounds); // Now require that immediate supertraits are converted, // which will, in turn, reach indirect supertraits. -- 2.44.0