|
1 | 1 | use std::collections::HashMap;
|
2 | 2 | use std::num::NonZeroU64;
|
3 |
| -use std::rc::Rc; |
4 | 3 |
|
5 | 4 | use anyhow::format_err;
|
6 | 5 | use log::debug;
|
@@ -35,7 +34,7 @@ pub struct Context {
|
35 | 34 |
|
36 | 35 | /// a way to look up for a package in activations what packages required it
|
37 | 36 | /// and all of the exact deps that it fulfilled.
|
38 |
| - pub parents: Graph<PackageId, Rc<Vec<Dependency>>>, |
| 37 | + pub parents: Graph<PackageId, im_rc::HashSet<Dependency>>, |
39 | 38 | }
|
40 | 39 |
|
41 | 40 | /// When backtracking it can be useful to know how far back to go.
|
@@ -265,14 +264,14 @@ impl Context {
|
265 | 264 | for (o, e) in self.parents.edges(i) {
|
266 | 265 | let old_link = graph.link(*o, *i);
|
267 | 266 | assert!(old_link.is_empty());
|
268 |
| - *old_link = e.to_vec(); |
| 267 | + *old_link = e.iter().cloned().collect(); |
269 | 268 | }
|
270 | 269 | }
|
271 | 270 | graph
|
272 | 271 | }
|
273 | 272 | }
|
274 | 273 |
|
275 |
| -impl Graph<PackageId, Rc<Vec<Dependency>>> { |
| 274 | +impl Graph<PackageId, im_rc::HashSet<Dependency>> { |
276 | 275 | pub fn parents_of(&self, p: PackageId) -> impl Iterator<Item = (PackageId, bool)> + '_ {
|
277 | 276 | self.edges(&p)
|
278 | 277 | .map(|(grand, d)| (*grand, d.iter().any(|x| x.is_public())))
|
@@ -338,7 +337,7 @@ impl PublicDependency {
|
338 | 337 | parent_pid: PackageId,
|
339 | 338 | is_public: bool,
|
340 | 339 | age: ContextAge,
|
341 |
| - parents: &Graph<PackageId, Rc<Vec<Dependency>>>, |
| 340 | + parents: &Graph<PackageId, im_rc::HashSet<Dependency>>, |
342 | 341 | ) {
|
343 | 342 | // one tricky part is that `candidate_pid` may already be active and
|
344 | 343 | // have public dependencies of its own. So we not only need to mark
|
@@ -383,7 +382,7 @@ impl PublicDependency {
|
383 | 382 | b_id: PackageId,
|
384 | 383 | parent: PackageId,
|
385 | 384 | is_public: bool,
|
386 |
| - parents: &Graph<PackageId, Rc<Vec<Dependency>>>, |
| 385 | + parents: &Graph<PackageId, im_rc::HashSet<Dependency>>, |
387 | 386 | ) -> Result<
|
388 | 387 | (),
|
389 | 388 | (
|
|
0 commit comments