Skip to content

Fix alias path for rustdoc#154571

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
chenyukang:yukang-fix-alias-path
May 2, 2026
Merged

Fix alias path for rustdoc#154571
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
chenyukang:yukang-fix-alias-path

Conversation

@chenyukang
Copy link
Copy Markdown
Member

I ran this command:

x build --stage 1  --skip rustdoc       
Building bootstrap
   Compiling bootstrap v0.0.0 (/Users/yukang/rust/src/bootstrap)
    Finished `dev` profile [unoptimized] target(s) in 1.08s
/Users/yukang/rust/build/aarch64-apple-darwin/ci-llvm/bin/llvm-strip does not exist; skipping copy
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.45s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts{alloc, compiler_builtins, core, panic_abort, panic_unwind, proc_macro, rustc-std-workspace-core, std, std_detect, sysroot, test, unwind} (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized + debuginfo] target(s) in 0.10s
Skipping Set({build::src/tools/rustdoc}) because it is excluded
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.19s

expect all rustdoc related compiling phase will be exlcuded, but from the log we can see rustdoc_tool_binary is still compiled.

src/tools/rustdoc and src/librustdoc are documented as aliases in path set here:

/// These are generally matched as a path suffix. For example, a
/// command-line value of `std` will match if `library/std` is in the
/// set.
///
/// NOTE: the paths within a set should always be aliases of one another.
/// For example, `src/librustdoc` and `src/tools/rustdoc` should be in the same set,

we can also see here two paths are treated as alias:

tool_check_step!(Rustdoc {
path: "src/tools/rustdoc",
alt_path: "src/librustdoc",
mode: Mode::ToolRustcPrivate
});

but bootstrap registered them as two different sets with .path(..).path(...):

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/rustdoc").path("src/librustdoc")
}

That meant commands like x build --skip rustdoc, --skip src/tools/rustdoc, or --skip src/librustdoc only excluded one side.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 30, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 30, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@jieyouxu
Copy link
Copy Markdown
Member

jieyouxu commented Apr 3, 2026

r? me

@rustbot rustbot assigned jieyouxu and unassigned Mark-Simulacrum Apr 3, 2026
Copy link
Copy Markdown
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

More of a question for other bootstrap maintainers

View changes since this review

Comment thread src/bootstrap/src/core/builder/mod.rs Outdated
Comment thread src/bootstrap/src/core/builder/mod.rs Outdated
}

/// Multiple on-disk paths that should be treated as aliases of one another.
pub fn path_aliases(mut self, paths: &[&str]) -> Self {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Discussion: hm, so this is a bit interesting, I'm not quite sure I like to call these "aliases", because for instance

run.path_aliases(&["src/librustdoc", "src/tools/rustdoc"])

Here src/librustdoc and src/tools/rustdoc may be considered should_run-eligible selectors for CrateRustdoc (which AFAIK is a "shared" common step for other rustdoc test steps), they are not really "aliases" I want to say... They are "eligible selectors"?

Not quite sure how to say this, curious to hear from other bootstrap maintainers.
cc @rust-lang/bootstrap

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is run.selectors(&["src/librustdoc", "src/tools/rustdoc"]) any clearer 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, selectors sounds clearer to me. These entries are not necessarily aliases in the semantic sense; they are multiple CLI selectors that should map to the same PathSet for selection/skipping.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think selectors is probably more accurate 👍

Co-authored-by: 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>
@jieyouxu
Copy link
Copy Markdown
Member

jieyouxu commented Apr 7, 2026

I'd like a second opinion on this.
@rustbot reroll

@rustbot rustbot assigned clubby789 and unassigned jieyouxu Apr 7, 2026
@chenyukang
Copy link
Copy Markdown
Member Author

@rustbot ready

@clubby789
Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 2, 2026

📌 Commit 7439d71 has been approved by clubby789

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 2, 2026
rust-bors Bot pushed a commit that referenced this pull request May 2, 2026
Rollup of 4 pull requests

Successful merges:

 - #154571 (Fix alias path for rustdoc)
 - #155749 (`-Znext-solver` Ignore region constraints from the nested goals in leakcheck)
 - #156026 (`bufreader::Buffer`: Remove leftover note about `initialized` field)
 - #156063 (Map `WSAESHUTDOWN` to `io::ErrorKind::BrokenPipe`)
@rust-bors rust-bors Bot merged commit 201d567 into rust-lang:main May 2, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 2, 2026
rust-timer added a commit that referenced this pull request May 2, 2026
Rollup merge of #154571 - chenyukang:yukang-fix-alias-path, r=clubby789

Fix alias path for rustdoc

I ran this command:

```console
x build --stage 1  --skip rustdoc
Building bootstrap
   Compiling bootstrap v0.0.0 (/Users/yukang/rust/src/bootstrap)
    Finished `dev` profile [unoptimized] target(s) in 1.08s
/Users/yukang/rust/build/aarch64-apple-darwin/ci-llvm/bin/llvm-strip does not exist; skipping copy
Building stage1 compiler artifacts (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.45s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage1 library artifacts{alloc, compiler_builtins, core, panic_abort, panic_unwind, proc_macro, rustc-std-workspace-core, std, std_detect, sysroot, test, unwind} (stage1 -> stage1, aarch64-apple-darwin)
    Finished `dist` profile [optimized + debuginfo] target(s) in 0.10s
Skipping Set({build::src/tools/rustdoc}) because it is excluded
Building stage1 rustdoc_tool_binary (stage0 -> stage1, aarch64-apple-darwin)
    Finished `release` profile [optimized + debuginfo] target(s) in 0.19s
```

expect all `rustdoc` related compiling phase will be exlcuded, but from the log we can see `rustdoc_tool_binary` is still compiled.

`src/tools/rustdoc` and `src/librustdoc` are documented as aliases in path set here:
https://github.com/rust-lang/rust/blob/a25435bcf7cfc9b953d356eda3a51db8da9e3386/src/bootstrap/src/core/builder/mod.rs#L355-L360

we can also see here two paths are treated as alias:
https://github.com/rust-lang/rust/blob/a25435bcf7cfc9b953d356eda3a51db8da9e3386/src/bootstrap/src/core/build_steps/check.rs#L818-L822

but bootstrap registered them as two different sets with `.path(..).path(...)`:
https://github.com/rust-lang/rust/blob/a25435bcf7cfc9b953d356eda3a51db8da9e3386/src/bootstrap/src/core/build_steps/tool.rs#L691-L693

That meant commands like `x build --skip rustdoc`, `--skip src/tools/rustdoc`, or `--skip src/librustdoc` only excluded one side.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants