Skip to content

Commit 8a4a291

Browse files
committed
fix borrowing the shell twice
1 parent f942d8d commit 8a4a291

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/cargo/core/resolver/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use url::Url;
5757

5858
use core::{PackageId, Registry, SourceId, Summary, Dependency};
5959
use core::PackageIdSpec;
60-
use core::shell::Shell;
60+
use util::config::Config;
6161
use util::Graph;
6262
use util::errors::{CargoResult, CargoError};
6363
use util::profile;
@@ -342,7 +342,7 @@ type Activations = HashMap<String, HashMap<SourceId, Vec<Summary>>>;
342342
pub fn resolve(summaries: &[(Summary, Method)],
343343
replacements: &[(PackageIdSpec, Dependency)],
344344
registry: &mut Registry,
345-
shell: Option<&mut Shell>) -> CargoResult<Resolve> {
345+
config: Option<&Config>) -> CargoResult<Resolve> {
346346
let cx = Context {
347347
resolve_graph: RcList::new(),
348348
resolve_features: HashMap::new(),
@@ -377,7 +377,8 @@ pub fn resolve(summaries: &[(Summary, Method)],
377377
trace!("resolved: {:?}", resolve);
378378

379379
// If we have a shell, emit warnings about required deps used as feature.
380-
if let Some(shell) = shell {
380+
if let Some(config) = config {
381+
let mut shell = config.shell();
381382
let mut warnings = &cx.warnings;
382383
while let Some(ref head) = warnings.head {
383384
shell.warn(&head.0)?;

src/cargo/ops/resolve.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,15 @@ pub fn resolve_with_previous<'a>(registry: &mut PackageRegistry,
257257
None => root_replace.to_vec(),
258258
};
259259

260-
let mut shell;
261-
let opt_shell = if warn {
262-
shell = ws.config().shell();
263-
Some(&mut *shell)
260+
let config = if warn {
261+
Some(ws.config())
264262
} else {
265263
None
266264
};
267265
let mut resolved = resolver::resolve(&summaries,
268266
&replace,
269267
registry,
270-
opt_shell)?;
268+
config)?;
271269
resolved.register_used_patches(registry.patches());
272270
if let Some(previous) = previous {
273271
resolved.merge_from(previous)?;

0 commit comments

Comments
 (0)