message: maintain an inverse-index
diff: @@ -1008,6 +1008,10 @@ fn activate_deps_loop(
  Vec<HashMap<PackageId, ConflictReason>>,
  > = HashMap::new();
  + // `past_conflict_triggers` is an inverse-index of `past_conflicting_activations`.
  + // For every `PackageId` this lists the `Dependency`s that mention it in `past_conflicting_activations`.
  + let mut past_conflict_triggers: HashMap<PackageId, HashSet<Dependency>> = HashMap::new();
  +
  // Activate all the initial summaries to kick off some work.
  for &(ref summary, ref method) in summaries {
  debug!("initial activation: {}", summary.package_id());
  @@ -1165,6 +1169,12 @@ fn activate_deps_loop(
  conflicting_activations
  );
  past.push(conflicting_activations.clone());
  + for c in conflicting_activations.keys() {
  + past_conflict_triggers
  + .entry(c.clone())
  + .or_insert_with(HashSet::new)
  + .insert(dep.clone());
  + }
  }
  }
  @@ -1284,15 +1294,18 @@ fn activate_deps_loop(
  }
  }
  if !has_past_conflicting_dep {
  - // TODO: this is ugly and slow, replace!
  + // TODO: this is ugly, replace!
  + if let Some(rel_deps) = past_conflict_triggers.get(&pid) {
  'deps: for debs in remaining_deps.iter() {
  for (_, (other_dep, _, _)) in debs.remaining_siblings.clone() {
  + if rel_deps.contains(&other_dep) {
  if let Some(conflict) = past_conflicting_activations
  .get(&other_dep)
  .and_then(|past_bad| {
  - past_bad
  - .iter()
  - .find(|conflicting| conflicting.get(&pid).is_some())
  + past_bad.iter().find(|con| {
  + con.contains_key(&pid)
  + && cx.is_conflicting(None, con)
  + })
  }) {
  conflicting_activations.insert(
  debs.parent.package_id().clone(),
  @@ -1304,6 +1317,8 @@ fn activate_deps_loop(
  }
  }
  }
  + }
  + }
  // Ok if we're in a "known failure" state for this frame we
  // may want to skip it altogether though. We don't want to
  