Skip to content

Commit 28af36f

Browse files
committed
Change for_host argument order for functions.
This consistently puts for_host next to PackageId, since the pair PackageId/for_host is used everywhere together. Somehow it seems better to me to consistently keep them close together.
1 parent 862df61 commit 28af36f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/cargo/core/resolver/features.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
378378
for (member, requested_features) in &member_features {
379379
let fvs = self.fvs_from_requested(member.package_id(), requested_features);
380380
let for_host = self.track_for_host && self.is_proc_macro(member.package_id());
381-
self.activate_pkg(member.package_id(), &fvs, for_host)?;
381+
self.activate_pkg(member.package_id(), for_host, &fvs)?;
382382
if for_host {
383383
// Also activate without for_host. This is needed if the
384384
// proc-macro includes other targets (like binaries or tests),
@@ -387,7 +387,7 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
387387
// `--workspace`), this forces feature unification with normal
388388
// dependencies. This is part of the bigger problem where
389389
// features depend on which packages are built.
390-
self.activate_pkg(member.package_id(), &fvs, false)?;
390+
self.activate_pkg(member.package_id(), false, &fvs)?;
391391
}
392392
}
393393
Ok(())
@@ -396,8 +396,8 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
396396
fn activate_pkg(
397397
&mut self,
398398
pkg_id: PackageId,
399-
fvs: &[FeatureValue],
400399
for_host: bool,
400+
fvs: &[FeatureValue],
401401
) -> CargoResult<()> {
402402
// Add an empty entry to ensure everything is covered. This is intended for
403403
// finding bugs where the resolver missed something it should have visited.
@@ -406,7 +406,7 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
406406
.entry((pkg_id, self.opts.decouple_host_deps && for_host))
407407
.or_insert_with(BTreeSet::new);
408408
for fv in fvs {
409-
self.activate_fv(pkg_id, fv, for_host)?;
409+
self.activate_fv(pkg_id, for_host, fv)?;
410410
}
411411
if !self.processed_deps.insert((pkg_id, for_host)) {
412412
// Already processed dependencies. There's no need to process them
@@ -433,7 +433,7 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
433433
}
434434
// Recurse into the dependency.
435435
let fvs = self.fvs_from_dependency(dep_pkg_id, dep);
436-
self.activate_pkg(dep_pkg_id, &fvs, dep_for_host)?;
436+
self.activate_pkg(dep_pkg_id, dep_for_host, &fvs)?;
437437
}
438438
}
439439
Ok(())
@@ -443,12 +443,12 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
443443
fn activate_fv(
444444
&mut self,
445445
pkg_id: PackageId,
446-
fv: &FeatureValue,
447446
for_host: bool,
447+
fv: &FeatureValue,
448448
) -> CargoResult<()> {
449449
match fv {
450450
FeatureValue::Feature(f) => {
451-
self.activate_rec(pkg_id, *f, for_host)?;
451+
self.activate_rec(pkg_id, for_host, *f)?;
452452
}
453453
FeatureValue::Dep { dep_name } => {
454454
// Mark this dependency as activated.
@@ -463,7 +463,7 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
463463
continue;
464464
}
465465
let fvs = self.fvs_from_dependency(dep_pkg_id, dep);
466-
self.activate_pkg(dep_pkg_id, &fvs, dep_for_host)?;
466+
self.activate_pkg(dep_pkg_id, dep_for_host, &fvs)?;
467467
}
468468
}
469469
}
@@ -483,17 +483,17 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
483483
let fv = FeatureValue::Dep {
484484
dep_name: *dep_name,
485485
};
486-
self.activate_fv(pkg_id, &fv, for_host)?;
486+
self.activate_fv(pkg_id, for_host, &fv)?;
487487
if !dep_prefix {
488488
// To retain compatibility with old behavior,
489489
// this also enables a feature of the same
490490
// name.
491-
self.activate_rec(pkg_id, *dep_name, for_host)?;
491+
self.activate_rec(pkg_id, for_host, *dep_name)?;
492492
}
493493
}
494494
// Activate the feature on the dependency.
495495
let fv = FeatureValue::new(*dep_feature);
496-
self.activate_fv(dep_pkg_id, &fv, dep_for_host)?;
496+
self.activate_fv(dep_pkg_id, dep_for_host, &fv)?;
497497
}
498498
}
499499
}
@@ -506,8 +506,8 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
506506
fn activate_rec(
507507
&mut self,
508508
pkg_id: PackageId,
509-
feature_to_enable: InternedString,
510509
for_host: bool,
510+
feature_to_enable: InternedString,
511511
) -> CargoResult<()> {
512512
let enabled = self
513513
.activated_features
@@ -534,7 +534,7 @@ impl<'a, 'cfg> FeatureResolver<'a, 'cfg> {
534534
}
535535
};
536536
for fv in fvs {
537-
self.activate_fv(pkg_id, fv, for_host)?;
537+
self.activate_fv(pkg_id, for_host, fv)?;
538538
}
539539
Ok(())
540540
}

0 commit comments

Comments
 (0)