Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3636,7 +3636,7 @@ impl Step for CodegenCranelift {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.paths(&["compiler/rustc_codegen_cranelift"])
run.paths(&["compiler/rustc_codegen_cranelift"]).path("compiler")
}

fn make_run(run: RunConfig<'_>) {
Expand Down Expand Up @@ -3754,7 +3754,7 @@ impl Step for CodegenGCC {
const IS_HOST: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.paths(&["compiler/rustc_codegen_gcc"])
run.paths(&["compiler/rustc_codegen_gcc"]).path("compiler")
}

fn make_run(run: RunConfig<'_>) {
Expand Down
16 changes: 8 additions & 8 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,18 @@ impl PathSet {
PathSet::Set(set)
}

fn has(&self, needle: &Path, module: Kind) -> bool {
fn has(&self, needle: &Path, module: Kind, filter_start: bool) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very wary of seeing cryptic booleans threaded through functions that are already have mysterious semantics to begin with.

This seems like it's going to cause a lot of frustration for whoever tries to properly clean up PathSet someday.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you like me to add more doc-comments, or convert it to an enum? I really do think the current behavior is not correct ... Happy to hear other suggestions for fixing it.

match self {
PathSet::Set(set) => set.iter().any(|p| Self::check(p, needle, module)),
PathSet::Suite(suite) => Self::check(suite, needle, module),
PathSet::Set(set) => set.iter().any(|p| Self::check(p, needle, module, filter_start)),
PathSet::Suite(suite) => Self::check(suite, needle, module, filter_start),
}
}

// internal use only
fn check(p: &TaskPath, needle: &Path, module: Kind) -> bool {
fn check(p: &TaskPath, needle: &Path, module: Kind, filter_start: bool) -> bool {
let check_path = || {
// This order is important for retro-compatibility, as `starts_with` was introduced later.
p.path.ends_with(needle) || p.path.starts_with(needle)
p.path.ends_with(needle) || (filter_start && p.path.starts_with(needle))
};
if let Some(p_kind) = &p.kind { check_path() && *p_kind == module } else { check_path() }
}
Expand All @@ -389,7 +389,7 @@ impl PathSet {
let mut check = |p| {
let mut result = false;
for n in needles.iter_mut() {
let matched = Self::check(p, &n.path, module);
let matched = Self::check(p, &n.path, module, false);
if matched {
n.will_be_executed = true;
result = true;
Expand Down Expand Up @@ -535,7 +535,7 @@ impl StepDescription {
}

fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool {
if builder.config.skip.iter().any(|e| pathset.has(e, builder.kind)) {
if builder.config.skip.iter().any(|e| pathset.has(e, builder.kind, true)) {
if !matches!(builder.config.get_dry_run(), DryRun::SelfCheck) {
println!("Skipping {pathset:?} because it is excluded");
}
Expand Down Expand Up @@ -1861,7 +1861,7 @@ Alternatively, you can set `build.local-rebuild=true` and use a stage0 compiler
let should_run = (desc.should_run)(ShouldRun::new(self, desc.kind));

for path in &self.paths {
if should_run.paths.iter().any(|s| s.has(path, desc.kind))
if should_run.paths.iter().any(|s| s.has(path, desc.kind, false))
&& !desc.is_excluded(
self,
&PathSet::Suite(TaskPath { path: path.clone(), kind: Some(desc.kind) }),
Expand Down
Loading