@@ -2,17 +2,15 @@ use std::collections::HashMap;
22use std:: num:: NonZeroU64 ;
33use std:: rc:: Rc ;
44
5- // "ensure" seems to require "bail" be in scope (macro hygiene issue?).
6- #[ allow( unused_imports) ]
7- use failure:: { bail, ensure} ;
5+ use failure:: format_err;
86use log:: debug;
97
108use crate :: core:: interning:: InternedString ;
119use crate :: core:: { Dependency , PackageId , SourceId , Summary } ;
12- use crate :: util:: CargoResult ;
1310use crate :: util:: Graph ;
1411
1512use super :: dep_cache:: RegistryQueryer ;
13+ use super :: errors:: ActivateResult ;
1614use super :: types:: { ConflictMap , FeaturesSet , ResolveOpts } ;
1715
1816pub use super :: encode:: Metadata ;
@@ -109,7 +107,7 @@ impl Context {
109107 summary : & Summary ,
110108 opts : & ResolveOpts ,
111109 parent : Option < ( & Summary , & Dependency ) > ,
112- ) -> CargoResult < bool > {
110+ ) -> ActivateResult < bool > {
113111 let id = summary. package_id ( ) ;
114112 let age: ContextAge = self . age ( ) ;
115113 match self . activations . entry ( id. as_activations_key ( ) ) {
@@ -122,12 +120,15 @@ impl Context {
122120 }
123121 im_rc:: hashmap:: Entry :: Vacant ( v) => {
124122 if let Some ( link) = summary. links ( ) {
125- ensure ! (
126- self . links. insert( link, id) . is_none( ) ,
127- "Attempting to resolve a dependency with more then one crate with the \
128- links={}.\n This will not build as is. Consider rebuilding the .lock file.",
129- & * link
130- ) ;
123+ if self . links . insert ( link, id) . is_some ( ) {
124+ return Err ( format_err ! (
125+ "Attempting to resolve a dependency with more then \
126+ one crate with links={}.\n This will not build as \
127+ is. Consider rebuilding the .lock file.",
128+ & * link
129+ )
130+ . into ( ) ) ;
131+ }
131132 }
132133 v. insert ( ( summary. clone ( ) , age) ) ;
133134
0 commit comments