message: Modify Context::flag_activated to return ActivateResult
diff: @@ -2,17 +2,15 @@ use std::collections::HashMap;
  use std::num::NonZeroU64;
  use std::rc::Rc;
  -// "ensure" seems to require "bail" be in scope (macro hygiene issue?).
  -#[allow(unused_imports)]
  -use failure::{bail, ensure};
  +use failure::format_err;
  use log::debug;
  use crate::core::interning::InternedString;
  use crate::core::{Dependency, PackageId, SourceId, Summary};
  -use crate::util::CargoResult;
  use crate::util::Graph;
  use super::dep_cache::RegistryQueryer;
  +use super::errors::ActivateResult;
  use super::types::{ConflictMap, FeaturesSet, ResolveOpts};
  pub use super::encode::Metadata;
  @@ -109,7 +107,7 @@ impl Context {
  summary: &Summary,
  opts: &ResolveOpts,
  parent: Option<(&Summary, &Dependency)>,
  - ) -> CargoResult<bool> {
  + ) -> ActivateResult<bool> {
  let id = summary.package_id();
  let age: ContextAge = self.age();
  match self.activations.entry(id.as_activations_key()) {
  @@ -122,12 +120,15 @@ impl Context {
  }
  im_rc::hashmap::Entry::Vacant(v) => {
  if let Some(link) = summary.links() {
  - ensure!(
  - self.links.insert(link, id).is_none(),
  - "Attempting to resolve a dependency with more then one crate with the \
  - links={}.\nThis will not build as is. Consider rebuilding the .lock file.",
  + if self.links.insert(link, id).is_some() {
  + return Err(format_err!(
  + "Attempting to resolve a dependency with more then \
  + one crate with links={}.\nThis will not build as \
  + is. Consider rebuilding the .lock file.",
  &*link
  - );
  + )
  + .into());
  + }
  }
  v.insert((summary.clone(), age));
  