Skip to content

Bootstrap does not set cfg(bootstrap) for build scripts #138032

Open
@tgross35

Description

@tgross35
Contributor

I was experimenting with some changes to compiler-builtins that were sensitive to bootstrap. --cfg=bootstrap does get passed to the crates but doesn't seem to pass to build scripts. E.g. for the build script:

Running `~/projects/rust/build/bootstrap/debug/rustc ~/projects/rust/build/bootstrap/debug/rustc --crate-name build_script_build --edition=2021 ~/.cargo/git/checkouts
/compiler-builtins-ef822f47a433bc09/4c7c9af/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C codegen-units=1
0000 -C debuginfo=line-tables-only -C overflow-checks=off --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' --check-cfg 'cfg(docsrs,test)
' --check-cfg 'cfg(feature, values("c", "cc", "compiler-builtins", "core", "default", "mangled-names", "mem", "no-asm", "no-f16-f128", "public-test-deps", "rustc-dep-of-std"))' -C metadata=63a45c0074c9ebec -
C extra-filename=-23c20e83882c80e9 --out-dir ~/projects/rust/build/x86_64-unknown-linux-gnu/stage0-std/release/build/compiler_builtins-23c20e83882c80e9 -L dependency=~/projects/rust/b
uild/x86_64-unknown-linux-gnu/stage0-std/release/deps --cap-lints allow -Z binary-dep-depinfo`

But for the crate itself:

~/projects/rust/build/bootstrap/debug/rustc ~/projects/rust/build/bootstrap/debug/rustc --crate-name compiler_builtins --edition=2021 ~/.cargo/git/checkouts/compiler-builtins-ef822f47a433bc09/4c7c9af/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=207 --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C codegen-units=10000 -C debuginfo=line-tables-only -C debug-assertions=on -C overflow-checks=off --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("c", "cc", "compiler-builtins", "core", "default", "mangled-names", "mem", "no-asm", "no-f16-f128", "public-test-deps", "rustc-dep-of-std"))' -C metadata=5a83d879a97eb522 -C extra-filename=-963761dda15d3919 --out-dir ~/projects/rust/build/x86_64-unknown-linux-gnu/stage0-std/s390x-unknown-linux-gnu/release/deps --target s390x-unknown-linux-gnu -C linker=s390x-linux-gnu-gcc -L dependency=~/projects/rust/build/x86_64-unknown-linux-gnu/stage0-std/s390x-unknown-linux-gnu/release/deps -L dependency=~/projects/rust/build/x86_64-unknown-linux-gnu/stage0-std/release/deps --extern core=~/projects/rust/build/x86_64-unknown-linux-gnu/stage0-std/s390x-unknown-linux-gnu/release/deps/librustc_std_workspace_core-5c763a693a66c7d8.rmeta --cap-lints allow --cfg=bootstrap ...

Is this behavior intentional?

Activity

added
C-bugCategory: This is a bug.
T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
on Mar 5, 2025
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Mar 5, 2025
bjorn3

bjorn3 commented on Mar 5, 2025

@bjorn3
Member
removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tgross35@bjorn3@onur-ozkan@rustbot

        Issue actions

          Bootstrap does not set `cfg(bootstrap)` for build scripts · Issue #138032 · rust-lang/rust