Repository: rust-lang/rust
File: src/bootstrap/src/core/builder/mod.rs (Rust)

Code before:
    // single alias, which does not correspond to any on-disk path
    pub fn alias(mut self, alias: &str) -> Self {
        // exceptional case for `Kind::Setup` because its `library`
        // and `compiler` options would otherwise naively match with
        // `compiler` and `library` folders respectively.
        assert!(
            self.kind == Kind::Setup || !self.builder.src.join(alias).exists(),
            "use `builder.path()` for real paths: {alias}"
        );
        self.paths.insert(PathSet::Set(
            std::iter::once(TaskPath { path: alias.into(), kind: Some(self.kind) }).collect(),
        ));
        self
    }

    /// single, non-aliased path
    ///
    /// Must be an on-disk path; use `alias` for names that do not correspond to on-disk paths.
    pub fn path(mut self, path: &str) -> Self {
        let submodules_paths = self.builder.submodule_paths();

        // assert only if `p` isn't submodule
        if !submodules_paths.iter().any(|sm_p| path.contains(sm_p)) {
            assert!(
                self.builder.src.join(path).exists(),
                "`should_run.paths` should correspond to real on-disk paths - use `alias` if there is no relevant path: {path}"
            );
        }

        let task = TaskPath { path: path.into(), kind: Some(self.kind) };
        self.paths.insert(PathSet::Set(BTreeSet::from_iter([task])));
        self
    }

    /// Handles individual files (not directories) within a test suite.
    fn is_suite_path(&self, requested_path: &Path) -> Option<&PathSet> {
        self.paths.iter().find(|pathset| match pathset {
            PathSet::Suite(suite) => requested_path.starts_with(&suite.path),
            PathSet::Set(_) => false,
        })
    }

    pub fn suite_path(mut self, suite: &str) -> Self {
        self.paths.insert(PathSet::Suite(TaskPath { path: suite.into(), kind: Some(self.kind) }));
        self
    }

    // allows being more explicit about why should_run in Step returns the value passed to it
    pub fn never(mut self) -> ShouldRun<'a> {
        self.paths.insert(PathSet::empty());
        self

Review comment (suggestion):
```suggestion
                "`should_run.path` should correspond to a real on-disk path - use `alias` if there is no relevant path: {path}"
```

Code after:
    // single alias, which does not correspond to any on-disk path
    pub fn alias(mut self, alias: &str) -> Self {
        // exceptional case for `Kind::Setup` because its `library`
        // and `compiler` options would otherwise naively match with
        // `compiler` and `library` folders respectively.
        assert!(
            self.kind == Kind::Setup || !self.builder.src.join(alias).exists(),
            "use `builder.path()` for real paths: {alias}"
        );
        self.paths.insert(PathSet::Set(
            std::iter::once(TaskPath { path: alias.into(), kind: Some(self.kind) }).collect(),
        ));
        self
    }

    /// single, non-aliased path
    ///
    /// Must be an on-disk path; use `alias` for names that do not correspond to on-disk paths.
    pub fn path(mut self, path: &str) -> Self {
        let submodules_paths = self.builder.submodule_paths();

        // assert only if `p` isn't submodule
        if !submodules_paths.iter().any(|sm_p| path.contains(sm_p)) {
            assert!(
                self.builder.src.join(path).exists(),
                "`should_run.path` should correspond to a real on-disk path - use `alias` if there is no relevant path: {path}"
            );
        }

        let task = TaskPath { path: path.into(), kind: Some(self.kind) };
        self.paths.insert(PathSet::Set(BTreeSet::from_iter([task])));
        self
    }

    /// Handles individual files (not directories) within a test suite.
    fn is_suite_path(&self, requested_path: &Path) -> Option<&PathSet> {
        self.paths.iter().find(|pathset| match pathset {
            PathSet::Suite(suite) => requested_path.starts_with(&suite.path),
            PathSet::Set(_) => false,
        })
    }

    pub fn suite_path(mut self, suite: &str) -> Self {
        self.paths.insert(PathSet::Suite(TaskPath { path: suite.into(), kind: Some(self.kind) }));
        self
    }

    // allows being more explicit about why should_run in Step returns the value passed to it
    pub fn never(mut self) -> ShouldRun<'a> {
        self.paths.insert(PathSet::empty());
        self