Skip to content

Double-check rustc flag handling in bootstrap #152709

@jieyouxu

Description

@jieyouxu

JSON target specs were destabilized in #150151 and #151534. However, this broke trying to build rustc itself with a JSON target spec. This is because in a few places bootstrap is manually calling rustc without the ability for the user to provide additional flags (primarily, -Zunstable-options to enable JSON targets).

There's a few different ways to fix this. One would be to change these calls to rustc to include flags provided by the user (such as RUSTFLAGS_NOT_BOOTSTRAP). Just to keep things simple, this PR proposes to just unconditionally pass -Zunstable-options.

Another consideration here is how maintainable this is. A possible improvement here would be to have a function somewhere (BootstrapCommand, TargetSelection, free function) that would handle appropriately adding the --target flag. For example, that's what cargo does in CompileKind::add_target_arg.

-- #152677

E-hard because this requires a lot of digging without mentoring bandwidth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-target-specsArea: Compile-target specificationsA-targetsArea: Concerning the implications of different compiler targetsC-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.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

    Issue actions