Skip to content

Commit 8a3602d

Browse files
committed
hack
1 parent 0ac6625 commit 8a3602d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

chalk-solve/src/coherence.rs

+18-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ where
109109
fn build_specialization_forest(&self) -> Result<Graph<ImplId<I>, ()>, CoherenceError<I>> {
110110
// FIXME(pierwill): Previously, the forest was built as a GraphMap
111111
// so that we never add multiple nodes with the same ItemId.
112-
// Will need to add a check for this.
113112
let mut forest = DiGraph::new();
114113

115114
// Find all specializations (implemented in coherence/solve)
@@ -119,7 +118,24 @@ where
119118
let l = forest.add_node(less_special);
120119
let m = forest.add_node(more_special);
121120

122-
forest.add_edge(l, m, ());
121+
// attempt to handle FIXME above...
122+
let (nodes, _) = forest.clone().into_nodes_edges();
123+
let mut already_exists = false;
124+
for x in nodes {
125+
// this isn't doing what we want...
126+
// `ItemId`? 🤔
127+
if !(less_special != x.weight && more_special != x.weight) {
128+
already_exists = true;
129+
}
130+
}
131+
println!("Already exists? {}", already_exists);
132+
if !already_exists {
133+
println!(
134+
"adding an edge from {:?} to {:?}",
135+
less_special, more_special
136+
);
137+
forest.add_edge(l, m, ());
138+
}
123139
})?;
124140

125141
Ok(forest)

0 commit comments

Comments
 (0)