Skip to content

Commit 1726c1b

Browse files
committed
Add some debugging output for specialization graph assembly
1 parent eaf2f90 commit 1726c1b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/librustc/middle/traits/specialize/specialization_graph.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ impl Graph {
6565
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
6666
let trait_def_id = trait_ref.def_id;
6767

68+
debug!("inserting TraitRef {:?} into specialization graph", trait_ref);
69+
6870
// if the reference itself contains an earlier error (e.g., due to a
6971
// resolution failure), then we just insert the impl at the top level of
7072
// the graph and claim that there's no overlap (in order to supress
@@ -99,10 +101,16 @@ impl Graph {
99101
let ge = specializes(tcx, possible_sibling, impl_def_id);
100102

101103
if le && !ge {
104+
let parent_trait_ref = tcx.impl_trait_ref(possible_sibling).unwrap();
105+
debug!("descending as child of TraitRef {:?}", parent_trait_ref);
106+
102107
// the impl specializes possible_sibling
103108
parent = possible_sibling;
104109
continue 'descend;
105110
} else if ge && !le {
111+
let child_trait_ref = tcx.impl_trait_ref(possible_sibling).unwrap();
112+
debug!("placing as parent of TraitRef {:?}", child_trait_ref);
113+
106114
// possible_sibling specializes the impl
107115
*slot = impl_def_id;
108116
self.parent.insert(impl_def_id, parent);
@@ -123,6 +131,7 @@ impl Graph {
123131
}
124132

125133
// no overlap with any potential siblings, so add as a new sibling
134+
debug!("placing as new sibling");
126135
self.parent.insert(impl_def_id, parent);
127136
possible_siblings.push(impl_def_id);
128137
return Ok(());

0 commit comments

Comments
 (0)