Skip to content

Commit 0ed9519

Browse files
authored
Auto merge of #37775 - alexcrichton:try-fix-dox, r=brson
rustbuild: Tweak default rule inclusion If a rule is flagged with `default(true)` then the pseudo-rule `default:foo` will include that. If a rule is also flagged with `.host(true)`, however, then the rule shouldn't be included for targets that aren't in the host array. This adds a filter to ensure we don't pull in host rules for targets by accident.
2 parents bd6a54d + 7cd8a49 commit 0ed9519

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/bootstrap/step.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,8 @@ impl<'a> Rules<'a> {
565565
for dep in rule.deps.iter() {
566566
let dep = dep(&self.sbuild.name(rule.name));
567567
if self.rules.contains_key(&dep.name) || dep.name.starts_with("default:") {
568-
continue }
568+
continue
569+
}
569570
panic!("\
570571
571572
invalid rule dependency graph detected, was a rule added and maybe typo'd?
@@ -686,8 +687,9 @@ invalid rule dependency graph detected, was a rule added and maybe typo'd?
686687
"dist" => Kind::Dist,
687688
kind => panic!("unknown kind: `{}`", kind),
688689
};
690+
let host = self.build.config.host.iter().any(|h| h == dep.target);
689691
let rules = self.rules.values().filter(|r| r.default);
690-
for rule in rules.filter(|r| r.kind == kind) {
692+
for rule in rules.filter(|r| r.kind == kind && (!r.host || host)) {
691693
self.fill(dep.name(rule.name), order, added);
692694
}
693695
} else {

0 commit comments

Comments
 (0)