Skip to content

Commit e1d9f37

Browse files
committed
better test
1 parent 0ac6625 commit e1d9f37

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

chalk-solve/src/coherence.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,21 @@ where
116116
// Record them in the forest by adding an edge from the less special
117117
// to the more special.
118118
self.visit_specializations_of_trait(|less_special, more_special| {
119-
let l = forest.add_node(less_special);
120-
let m = forest.add_node(more_special);
119+
let nodes = forest.raw_nodes();
120+
let mut goodnodes: Vec<ImplId<_>> = vec![];
121121

122-
forest.add_edge(l, m, ());
122+
for node in nodes {
123+
goodnodes.push(node.weight);
124+
}
125+
126+
if !goodnodes.contains(&less_special) && !goodnodes.contains(&more_special) {
127+
let l = forest.add_node(less_special);
128+
let m = forest.add_node(more_special);
129+
130+
#[rustfmt::skip]
131+
println!( "adding an edge from {:?} to {:?}", less_special, more_special );
132+
forest.add_edge(l, m, ());
133+
}
123134
})?;
124135

125136
Ok(forest)

0 commit comments

Comments
 (0)