fix borrowing the shell twice
authorRalf Jung <post@ralfj.de>
Fri, 18 Aug 2017 18:10:34 +0000 (20:10 +0200)
committerRalf Jung <post@ralfj.de>
Fri, 18 Aug 2017 18:10:34 +0000 (20:10 +0200)
src/cargo/core/resolver/mod.rs
src/cargo/ops/resolve.rs

index 2b751d6a89080b7053422707e263016f3ca97a48..4b633c26d6947fd01393be0157e76d1bbf9d778a 100644 (file)
@@ -57,7 +57,7 @@ use url::Url;
 
 use core::{PackageId, Registry, SourceId, Summary, Dependency};
 use core::PackageIdSpec;
-use core::shell::Shell;
+use util::config::Config;
 use util::Graph;
 use util::errors::{CargoResult, CargoError};
 use util::profile;
@@ -342,7 +342,7 @@ type Activations = HashMap<String, HashMap<SourceId, Vec<Summary>>>;
 pub fn resolve(summaries: &[(Summary, Method)],
                replacements: &[(PackageIdSpec, Dependency)],
                registry: &mut Registry,
-               shell: Option<&mut Shell>) -> CargoResult<Resolve> {
+               config: Option<&Config>) -> CargoResult<Resolve> {
     let cx = Context {
         resolve_graph: RcList::new(),
         resolve_features: HashMap::new(),
@@ -377,7 +377,8 @@ pub fn resolve(summaries: &[(Summary, Method)],
     trace!("resolved: {:?}", resolve);
 
     // If we have a shell, emit warnings about required deps used as feature.
-    if let Some(shell) = shell {
+    if let Some(config) = config {
+        let mut shell = config.shell();
         let mut warnings = &cx.warnings;
         while let Some(ref head) = warnings.head {
             shell.warn(&head.0)?;
index 074f798985aa478adebe7b8b44c8a71deb0a3f2c..cd88738cae4577d7ff5c2797b8fc4510c2db6d49 100644 (file)
@@ -257,17 +257,15 @@ pub fn resolve_with_previous<'a>(registry: &mut PackageRegistry,
         None => root_replace.to_vec(),
     };
 
-    let mut shell;
-    let opt_shell = if warn {
-        shell = ws.config().shell();
-        Some(&mut *shell)
+    let config = if warn {
+        Some(ws.config())
     } else {
         None
     };
     let mut resolved = resolver::resolve(&summaries,
                                          &replace,
                                          registry,
-                                         opt_shell)?;
+                                         config)?;
     resolved.register_used_patches(registry.patches());
     if let Some(previous) = previous {
         resolved.merge_from(previous)?;