Skip to content

Commit 4c1f84b

Browse files
committed
Revert addition of a number of Config params
1 parent 6704634 commit 4c1f84b

22 files changed

+88
-99
lines changed

src/cargo/core/package.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl<'cfg> PackageSet<'cfg> {
156156
Box::new(self.packages.iter().map(|&(ref p, _)| p))
157157
}
158158

159-
pub fn get(&self, id: &PackageId, config: &Config) -> CargoResult<&Package> {
159+
pub fn get(&self, id: &PackageId) -> CargoResult<&Package> {
160160
let slot = try!(self.packages.iter().find(|p| p.0 == *id).chain_error(|| {
161161
internal(format!("couldn't find `{}` in package set", id))
162162
}));
@@ -168,7 +168,7 @@ impl<'cfg> PackageSet<'cfg> {
168168
let source = try!(sources.get_mut(id.source_id()).chain_error(|| {
169169
internal(format!("couldn't find source for `{}`", id))
170170
}));
171-
let pkg = try!(source.download(id, config).chain_error(|| {
171+
let pkg = try!(source.download(id).chain_error(|| {
172172
human("unable to get packages from source")
173173
}));
174174
assert!(slot.fill(pkg).is_ok());

src/cargo/core/registry.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use sources::config::SourceConfigMap;
1010
/// See also `core::Source`.
1111
pub trait Registry {
1212
/// Attempt to find the packages that match a dependency request.
13-
fn query(&mut self, name: &Dependency, config: &Config) -> CargoResult<Vec<Summary>>;
13+
fn query(&mut self, name: &Dependency) -> CargoResult<Vec<Summary>>;
1414

1515
/// Returns whether or not this registry will return summaries with
1616
/// checksums listed.
@@ -22,22 +22,22 @@ pub trait Registry {
2222
}
2323

2424
impl Registry for Vec<Summary> {
25-
fn query(&mut self, dep: &Dependency, _config: &Config) -> CargoResult<Vec<Summary>> {
25+
fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
2626
Ok(self.iter().filter(|summary| dep.matches(*summary))
2727
.cloned().collect())
2828
}
2929
}
3030

3131
impl Registry for Vec<Package> {
32-
fn query(&mut self, dep: &Dependency, _config: &Config) -> CargoResult<Vec<Summary>> {
32+
fn query(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> {
3333
Ok(self.iter().filter(|pkg| dep.matches(pkg.summary()))
3434
.map(|pkg| pkg.summary().clone()).collect())
3535
}
3636
}
3737

3838
impl<'a, T: ?Sized + Registry + 'a> Registry for Box<T> {
39-
fn query(&mut self, name: &Dependency, config: &Config) -> CargoResult<Vec<Summary>> {
40-
(**self).query(name, config)
39+
fn query(&mut self, name: &Dependency) -> CargoResult<Vec<Summary>> {
40+
(**self).query(name)
4141
}
4242
}
4343

src/cargo/core/resolver/mod.rs

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use semver;
5555

5656
use core::{PackageId, Registry, SourceId, Summary, Dependency};
5757
use core::PackageIdSpec;
58-
use util::{CargoResult, Graph, human, CargoError, Config};
58+
use util::{CargoResult, Graph, human, CargoError};
5959
use util::profile;
6060
use util::ChainError;
6161
use util::graph::{Nodes, Edges};
@@ -265,8 +265,7 @@ struct Context<'a> {
265265
/// Builds the list of all packages required to build the first argument.
266266
pub fn resolve(summaries: &[(Summary, Method)],
267267
replacements: &[(PackageIdSpec, Dependency)],
268-
registry: &mut Registry,
269-
config: &Config) -> CargoResult<Resolve> {
268+
registry: &mut Registry) -> CargoResult<Resolve> {
270269
let cx = Context {
271270
resolve_graph: Graph::new(),
272271
resolve_features: HashMap::new(),
@@ -275,7 +274,7 @@ pub fn resolve(summaries: &[(Summary, Method)],
275274
replacements: replacements,
276275
};
277276
let _p = profile::start(format!("resolving"));
278-
let cx = try!(activate_deps_loop(cx, registry, summaries, config));
277+
let cx = try!(activate_deps_loop(cx, registry, summaries));
279278

280279
let mut resolve = Resolve {
281280
graph: cx.resolve_graph,
@@ -306,8 +305,7 @@ fn activate(cx: &mut Context,
306305
registry: &mut Registry,
307306
parent: Option<&Rc<Summary>>,
308307
candidate: Candidate,
309-
method: &Method,
310-
config: &Config)
308+
method: &Method)
311309
-> CargoResult<Option<DepsFrame>> {
312310
if let Some(parent) = parent {
313311
cx.resolve_graph.link(parent.package_id().clone(),
@@ -335,7 +333,7 @@ fn activate(cx: &mut Context,
335333
}
336334
};
337335

338-
let deps = try!(cx.build_deps(registry, &candidate, method, config));
336+
let deps = try!(cx.build_deps(registry, &candidate, method));
339337

340338
Ok(Some(DepsFrame {
341339
parent: candidate,
@@ -437,8 +435,7 @@ struct BacktrackFrame<'a> {
437435
/// dependency graph, cx.resolve is returned.
438436
fn activate_deps_loop<'a>(mut cx: Context<'a>,
439437
registry: &mut Registry,
440-
summaries: &[(Summary, Method)],
441-
config: &Config)
438+
summaries: &[(Summary, Method)])
442439
-> CargoResult<Context<'a>> {
443440
// Note that a `BinaryHeap` is used for the remaining dependencies that need
444441
// activation. This heap is sorted such that the "largest value" is the most
@@ -454,7 +451,7 @@ fn activate_deps_loop<'a>(mut cx: Context<'a>,
454451
let summary = Rc::new(summary.clone());
455452
let candidate = Candidate { summary: summary, replace: None };
456453
remaining_deps.extend(try!(activate(&mut cx, registry, None, candidate,
457-
method, config)));
454+
method)));
458455
}
459456

460457
// Main resolution loop, this is the workhorse of the resolution algorithm.
@@ -548,8 +545,7 @@ fn activate_deps_loop<'a>(mut cx: Context<'a>,
548545
None => return Err(activation_error(&cx, registry, &parent,
549546
&dep,
550547
&cx.prev_active(&dep),
551-
&candidates,
552-
config)),
548+
&candidates)),
553549
Some(candidate) => candidate,
554550
}
555551
}
@@ -563,7 +559,7 @@ fn activate_deps_loop<'a>(mut cx: Context<'a>,
563559
trace!("{}[{}]>{} trying {}", parent.name(), cur, dep.name(),
564560
candidate.summary.version());
565561
remaining_deps.extend(try!(activate(&mut cx, registry, Some(&parent),
566-
candidate, &method, config)));
562+
candidate, &method)));
567563
}
568564

569565
Ok(cx)
@@ -599,8 +595,7 @@ fn activation_error(cx: &Context,
599595
parent: &Summary,
600596
dep: &Dependency,
601597
prev_active: &[Rc<Summary>],
602-
candidates: &[Candidate],
603-
config: &Config) -> Box<CargoError> {
598+
candidates: &[Candidate]) -> Box<CargoError> {
604599
if candidates.len() > 0 {
605600
let mut msg = format!("failed to select a version for `{}` \
606601
(required by `{}`):\n\
@@ -653,7 +648,7 @@ fn activation_error(cx: &Context,
653648
let mut msg = msg;
654649
let all_req = semver::VersionReq::parse("*").unwrap();
655650
let new_dep = dep.clone_inner().set_version_req(all_req).into_dependency();
656-
let mut candidates = match registry.query(&new_dep, config) {
651+
let mut candidates = match registry.query(&new_dep) {
657652
Ok(candidates) => candidates,
658653
Err(e) => return e,
659654
};
@@ -821,8 +816,7 @@ impl<'a> Context<'a> {
821816
fn build_deps(&mut self,
822817
registry: &mut Registry,
823818
candidate: &Summary,
824-
method: &Method,
825-
config: &Config) -> CargoResult<Vec<DepInfo>> {
819+
method: &Method) -> CargoResult<Vec<DepInfo>> {
826820
// First, figure out our set of dependencies based on the requsted set
827821
// of features. This also calculates what features we're going to enable
828822
// for our own dependencies.
@@ -831,7 +825,7 @@ impl<'a> Context<'a> {
831825
// Next, transform all dependencies into a list of possible candidates
832826
// which can satisfy that dependency.
833827
let mut deps = try!(deps.into_iter().map(|(dep, features)| {
834-
let mut candidates = try!(self.query(registry, &dep, config));
828+
let mut candidates = try!(self.query(registry, &dep));
835829
// When we attempt versions for a package, we'll want to start at
836830
// the maximum version and work our way down.
837831
candidates.sort_by(|a, b| {
@@ -857,9 +851,8 @@ impl<'a> Context<'a> {
857851
/// return.
858852
fn query(&self,
859853
registry: &mut Registry,
860-
dep: &Dependency,
861-
config: &Config) -> CargoResult<Vec<Candidate>> {
862-
let summaries = try!(registry.query(dep, config));
854+
dep: &Dependency) -> CargoResult<Vec<Candidate>> {
855+
let summaries = try!(registry.query(dep));
863856
summaries.into_iter().map(Rc::new).map(|summary| {
864857
// get around lack of non-lexical lifetimes
865858
let summary2 = summary.clone();
@@ -872,7 +865,7 @@ impl<'a> Context<'a> {
872865
Some(replacement) => replacement,
873866
};
874867

875-
let mut summaries = try!(registry.query(dep, config)).into_iter();
868+
let mut summaries = try!(registry.query(dep)).into_iter();
876869
let s = try!(summaries.next().chain_error(|| {
877870
human(format!("no matching package for override `{}` found\n\
878871
location searched: {}\n\

src/cargo/core/source.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait Source: Registry {
2727

2828
/// The download method fetches the full package for each name and
2929
/// version specified.
30-
fn download(&mut self, package: &PackageId, config: &Config) -> CargoResult<Package>;
30+
fn download(&mut self, package: &PackageId) -> CargoResult<Package>;
3131

3232
/// Generates a unique string which represents the fingerprint of the
3333
/// current state of the source.
@@ -57,8 +57,8 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box<T> {
5757
(**self).update()
5858
}
5959

60-
fn download(&mut self, id: &PackageId, config: &Config) -> CargoResult<Package> {
61-
(**self).download(id, config)
60+
fn download(&mut self, id: &PackageId) -> CargoResult<Package> {
61+
(**self).download(id)
6262
}
6363

6464
fn fingerprint(&self, pkg: &Package) -> CargoResult<String> {

src/cargo/ops/cargo_clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn clean(ws: &Workspace, opts: &CleanOptions) -> CargoResult<()> {
4747
for spec in opts.spec {
4848
// Translate the spec to a Package
4949
let pkgid = try!(resolve.query(spec));
50-
let pkg = try!(packages.get(&pkgid, ws.config()));
50+
let pkg = try!(packages.get(&pkgid));
5151

5252
// Generate all relevant `Unit` targets for this package
5353
for target in pkg.targets() {

src/cargo/ops/cargo_compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub fn compile_ws<'a>(ws: &Workspace<'a>,
190190
};
191191

192192
let to_builds = try!(pkgids.iter().map(|id| {
193-
packages.get(id, config)
193+
packages.get(id)
194194
}).collect::<CargoResult<Vec<_>>>());
195195

196196
let mut general_targets = Vec::new();

src/cargo/ops/cargo_fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn fetch<'a>(ws: &Workspace<'a>) -> CargoResult<(Resolve, PackageSet<'a>)> {
99
let resolve = try!(ops::resolve_ws(&mut registry, ws));
1010
let packages = get_resolved_packages(&resolve, registry);
1111
for id in resolve.iter() {
12-
try!(packages.get(id, ws.config()));
12+
try!(packages.get(id));
1313
}
1414
Ok((resolve, packages))
1515
}

src/cargo/ops/cargo_install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ fn select_pkg<'a, T>(mut source: T,
260260
match name {
261261
Some(name) => {
262262
let dep = try!(Dependency::parse(name, vers, source_id, config));
263-
let deps = try!(source.query(&dep, config));
263+
let deps = try!(source.query(&dep));
264264
match deps.iter().map(|p| p.package_id()).max() {
265265
Some(pkgid) => {
266-
let pkg = try!(source.download(pkgid, config));
266+
let pkg = try!(source.download(pkgid));
267267
Ok((pkg, Box::new(source)))
268268
}
269269
None => {

src/cargo/ops/cargo_output_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn metadata_full(ws: &Workspace,
5252
let (packages, resolve) = deps;
5353

5454
let packages = try!(packages.package_ids()
55-
.map(|i| packages.get(i, ws.config()).map(|p| p.clone()))
55+
.map(|i| packages.get(i).map(|p| p.clone()))
5656
.collect());
5757

5858
Ok(ExportInfo {

src/cargo/ops/cargo_rustc/context.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
156156
}
157157
}));
158158
}
159-
for dep in try!(self.dep_targets(&unit, self.config)) {
159+
for dep in try!(self.dep_targets(&unit)) {
160160
try!(self.visit_crate_type(&dep, crate_types));
161161
}
162162
Ok(())
@@ -251,29 +251,26 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
251251
for unit in units {
252252
try!(self.walk_used_in_plugin_map(unit,
253253
unit.target.for_host(),
254-
&mut visited,
255-
self.config));
254+
&mut visited));
256255
}
257256
Ok(())
258257
}
259258

260259
fn walk_used_in_plugin_map(&mut self,
261260
unit: &Unit<'a>,
262261
is_plugin: bool,
263-
visited: &mut HashSet<(Unit<'a>, bool)>,
264-
config: &Config)
262+
visited: &mut HashSet<(Unit<'a>, bool)>)
265263
-> CargoResult<()> {
266264
if !visited.insert((*unit, is_plugin)) {
267265
return Ok(())
268266
}
269267
if is_plugin {
270268
self.used_in_plugin.insert(*unit);
271269
}
272-
for unit in try!(self.dep_targets(unit, config)) {
270+
for unit in try!(self.dep_targets(unit)) {
273271
try!(self.walk_used_in_plugin_map(&unit,
274272
is_plugin || unit.target.for_host(),
275-
visited,
276-
config));
273+
visited));
277274
}
278275
Ok(())
279276
}
@@ -446,11 +443,11 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
446443

447444
/// For a package, return all targets which are registered as dependencies
448445
/// for that package.
449-
pub fn dep_targets(&self, unit: &Unit<'a>, config: &Config) -> CargoResult<Vec<Unit<'a>>> {
446+
pub fn dep_targets(&self, unit: &Unit<'a>) -> CargoResult<Vec<Unit<'a>>> {
450447
if unit.profile.run_custom_build {
451448
return self.dep_run_custom_build(unit)
452449
} else if unit.profile.doc {
453-
return self.doc_deps(unit, config);
450+
return self.doc_deps(unit);
454451
}
455452

456453
let id = unit.pkg.package_id();
@@ -493,7 +490,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
493490
true
494491
})
495492
}).filter_map(|id| {
496-
match self.get_package(id, config) {
493+
match self.get_package(id) {
497494
Ok(pkg) => {
498495
pkg.targets().iter().find(|t| t.is_lib()).map(|t| {
499496
Ok(Unit {
@@ -567,7 +564,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
567564
profile: &self.profiles.dev,
568565
..*unit
569566
};
570-
let deps = try!(self.dep_targets(&tmp, self.config));
567+
let deps = try!(self.dep_targets(&tmp));
571568
Ok(deps.iter().filter_map(|unit| {
572569
if !unit.target.linkable() || unit.pkg.manifest().links().is_none() {
573570
return None
@@ -581,7 +578,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
581578
}
582579

583580
/// Returns the dependencies necessary to document a package
584-
fn doc_deps(&self, unit: &Unit<'a>, config: &Config) -> CargoResult<Vec<Unit<'a>>> {
581+
fn doc_deps(&self, unit: &Unit<'a>) -> CargoResult<Vec<Unit<'a>>> {
585582
let deps = self.resolve.deps(unit.pkg.package_id()).filter(|dep| {
586583
unit.pkg.dependencies().iter().filter(|d| {
587584
d.name() == dep.name()
@@ -593,7 +590,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
593590
}
594591
})
595592
}).map(|dep| {
596-
self.get_package(dep, config)
593+
self.get_package(dep)
597594
});
598595

599596
// To document a library, we depend on dependencies actually being
@@ -676,8 +673,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
676673
}
677674

678675
/// Gets a package for the given package id.
679-
pub fn get_package(&self, id: &PackageId, config: &Config) -> CargoResult<&'a Package> {
680-
self.packages.get(id, config)
676+
pub fn get_package(&self, id: &PackageId) -> CargoResult<&'a Package> {
677+
self.packages.get(id)
681678
}
682679

683680
/// Get the user-specified linker for a particular host or target

0 commit comments

Comments
 (0)