Skip to content

Commit 9f38ce0

Browse files
committed
Add x {check,build,doc} {compiler/library} aliases.
While working on #95503, I realized that this will interfere with existing command lines: Currently people run `x build library/std` expecting it to be added to the sysroot, but after that change, it will *only* build `libstd` without making it available for the toolchain. It's debatable whether that's a breaking change that will be accepted; if so, this PR is absolutely necessary to make sure there's a command for "build the standard library and add it to the sysroot". Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`. For consistency, also add support for `compiler` and all other command variants. Note that `doc compiler` was already supported, so in a sense this is just fixing an existing inconsistency. I plan to change the dev-guide and various instructions in the README to `build library` once this is merged.
1 parent 11909e3 commit 9f38ce0

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/bootstrap/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Step for Std {
6464
const DEFAULT: bool = true;
6565

6666
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
67-
run.all_krates("test")
67+
run.all_krates("test").path("library")
6868
}
6969

7070
fn make_run(run: RunConfig<'_>) {
@@ -162,7 +162,7 @@ impl Step for Rustc {
162162
const DEFAULT: bool = true;
163163

164164
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
165-
run.all_krates("rustc-main")
165+
run.all_krates("rustc-main").path("compiler")
166166
}
167167

168168
fn make_run(run: RunConfig<'_>) {

src/bootstrap/compile.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Step for Std {
4343
// When downloading stage1, the standard library has already been copied to the sysroot, so
4444
// there's no need to rebuild it.
4545
let download_rustc = run.builder.config.download_rustc;
46-
run.all_krates("test").default_condition(!download_rustc)
46+
run.all_krates("test").path("library").default_condition(!download_rustc)
4747
}
4848

4949
fn make_run(run: RunConfig<'_>) {
@@ -1047,7 +1047,7 @@ impl Step for Assemble {
10471047
const ONLY_HOSTS: bool = true;
10481048

10491049
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1050-
run.path("compiler/rustc")
1050+
run.path("compiler/rustc").path("compiler")
10511051
}
10521052

10531053
fn make_run(run: RunConfig<'_>) {

src/bootstrap/doc.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl Step for Std {
417417

418418
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
419419
let builder = run.builder;
420-
run.all_krates("test").default_condition(builder.config.docs)
420+
run.all_krates("test").path("library").default_condition(builder.config.docs)
421421
}
422422

423423
fn make_run(run: RunConfig<'_>) {
@@ -479,11 +479,14 @@ impl Step for Std {
479479
.iter()
480480
.map(components_simplified)
481481
.filter_map(|path| {
482-
if path.get(0) == Some(&"library") {
482+
if path.len() >= 2 && path.get(0) == Some(&"library") {
483+
// single crate
483484
Some(path[1].to_owned())
484485
} else if !path.is_empty() {
486+
// ??
485487
Some(path[0].to_owned())
486488
} else {
489+
// all library crates
487490
None
488491
}
489492
})

0 commit comments

Comments
 (0)