@@ -2,17 +2,15 @@ use std::collections::HashMap;
2
2
use std:: num:: NonZeroU64 ;
3
3
use std:: rc:: Rc ;
4
4
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;
8
6
use log:: debug;
9
7
10
8
use crate :: core:: interning:: InternedString ;
11
9
use crate :: core:: { Dependency , PackageId , SourceId , Summary } ;
12
- use crate :: util:: CargoResult ;
13
10
use crate :: util:: Graph ;
14
11
15
12
use super :: dep_cache:: RegistryQueryer ;
13
+ use super :: errors:: ActivateResult ;
16
14
use super :: types:: { ConflictMap , FeaturesSet , ResolveOpts } ;
17
15
18
16
pub use super :: encode:: Metadata ;
@@ -109,7 +107,7 @@ impl Context {
109
107
summary : & Summary ,
110
108
opts : & ResolveOpts ,
111
109
parent : Option < ( & Summary , & Dependency ) > ,
112
- ) -> CargoResult < bool > {
110
+ ) -> ActivateResult < bool > {
113
111
let id = summary. package_id ( ) ;
114
112
let age: ContextAge = self . age ( ) ;
115
113
match self . activations . entry ( id. as_activations_key ( ) ) {
@@ -122,12 +120,15 @@ impl Context {
122
120
}
123
121
im_rc:: hashmap:: Entry :: Vacant ( v) => {
124
122
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
+ }
131
132
}
132
133
v. insert ( ( summary. clone ( ) , age) ) ;
133
134
0 commit comments