target: fix destabilising target-spec-json#151534
Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom Feb 4, 2026
Merged
target: fix destabilising target-spec-json#151534rust-bors[bot] merged 2 commits intorust-lang:mainfrom
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Conversation
Collaborator
|
r? @chenyukang rustbot has assigned @chenyukang. Use |
This comment has been minimized.
This comment has been minimized.
4 tasks
ehuss
added a commit
to ehuss/cargo
that referenced
this pull request
Jan 25, 2026
This adds the `-Z json-target-spec` CLI flag to assist with using custom `.json` target spec files. `rustc` recently switched so that it requires `-Z unstable-options` when using custom spec files (rust-lang/rust#151534). This can make it rather awkward to use spec files with cargo because it then requires setting RUSTFLAGS and RUSTDOCFLAGS to pass `-Zunstable-options`. It also ends up causing some confusing error messages. Now, using `--target` with `.json` extension files generates an error that explains you need `-Zjson-target-spec`. The only thing this flag does is disable that error, and automatically passes `-Zunstable-options` with the `--target` flag. This does not 100% cover json target spec files, because they can be placed in RUST_TARGET_PATH or the sysroot, and `rustc` will automatically search for them (without the `.json` extension in the `--target` arg). The user will just need to use RUSTFLAGS/RUSTDOCFLAGS in that situation (but I expect that to be rare). The majority of this change is changing `CompileTarget::new` to take a flag if `-Zjson-target-spec` is enabled, and then threading through all the places that call it. `CompileTarget::new` is responsible for generating an error if json is used without the Z flag.
ehuss
added a commit
to ehuss/cargo
that referenced
this pull request
Jan 25, 2026
This adds the `-Z json-target-spec` CLI flag to assist with using custom `.json` target spec files. `rustc` recently switched so that it requires `-Z unstable-options` when using custom spec files (rust-lang/rust#151534). This can make it rather awkward to use spec files with cargo because it then requires setting RUSTFLAGS and RUSTDOCFLAGS to pass `-Zunstable-options`. It also ends up causing some confusing error messages. Now, using `--target` with `.json` extension files generates an error that explains you need `-Zjson-target-spec`. The only thing this flag does is disable that error, and automatically passes `-Zunstable-options` with the `--target` flag. This does not 100% cover json target spec files, because they can be placed in RUST_TARGET_PATH or the sysroot, and `rustc` will automatically search for them (without the `.json` extension in the `--target` arg). The user will just need to use RUSTFLAGS/RUSTDOCFLAGS in that situation (but I expect that to be rare). The majority of this change is changing `CompileTarget::new` to take a flag if `-Zjson-target-spec` is enabled, and then threading through all the places that call it. `CompileTarget::new` is responsible for generating an error if json is used without the Z flag.
github-merge-queue bot
pushed a commit
to rust-lang/cargo
that referenced
this pull request
Jan 25, 2026
This adds the `-Z json-target-spec` CLI flag to assist with using custom `.json` target spec files. `rustc` recently switched so that it requires `-Z unstable-options` when using custom spec files (rust-lang/rust#151534). This can make it rather awkward to use spec files with cargo because it then requires setting RUSTFLAGS and RUSTDOCFLAGS to pass `-Zunstable-options`. It also ends up causing some confusing error messages. See the individual commits for more details. This ended up being a larger diff than I wanted. I'm not 100% certain this is worth it, but I think it significantly improves the experience using `.json` files, so I I'm leaning towards it. ### How to test and review this PR? Testing can be done with `rustc` built from rust-lang/rust#151534 to ensure that everything passes after that PR (including setting `CARGO_RUN_BUILD_STD_TESTS=1`).
ranger-ross
pushed a commit
to ranger-ross/cargo
that referenced
this pull request
Jan 25, 2026
This adds the `-Z json-target-spec` CLI flag to assist with using custom `.json` target spec files. `rustc` recently switched so that it requires `-Z unstable-options` when using custom spec files (rust-lang/rust#151534). This can make it rather awkward to use spec files with cargo because it then requires setting RUSTFLAGS and RUSTDOCFLAGS to pass `-Zunstable-options`. It also ends up causing some confusing error messages. See the individual commits for more details. This ended up being a larger diff than I wanted. I'm not 100% certain this is worth it, but I think it significantly improves the experience using `.json` files, so I I'm leaning towards it. Testing can be done with `rustc` built from rust-lang/rust#151534 to ensure that everything passes after that PR (including setting `CARGO_RUN_BUILD_STD_TESTS=1`).
ad34ef3 to
76b6623
Compare
This comment has been minimized.
This comment has been minimized.
Member
Author
|
I'm at a loss for how this could be impacting the rustdoc-gui tests |
Contributor
|
The GUI tests have been failing frequently lately, see #93784. |
Member
|
@bors r=chenyukang |
Contributor
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Jan 27, 2026
…json-again, r=chenyukang target: fix destabilising target-spec-json cc rust-lang#151528 rust-lang#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that. Closes rust-lang#71009
Zalathar
added a commit
to Zalathar/rust
that referenced
this pull request
Jan 27, 2026
…json-again, r=chenyukang target: fix destabilising target-spec-json cc rust-lang#151528 rust-lang#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that. Closes rust-lang#71009
Member
|
Failed in rollup in @bors r- |
Contributor
|
Commit 76b6623 has been unapproved. |
ojeda
added a commit
to Rust-for-Linux/linux
that referenced
this pull request
Jan 27, 2026
Custom target specifications are unstable, but starting with Rust 1.95.0,
`rustc` requires to explicitly pass `-Zunstable-options` to use them [1]:
error: error loading target specification: custom targets are unstable and require `-Zunstable-options`
|
= help: run `rustc --print target-list` for a list of built-in targets
David (Rust compiler team lead), writes:
"We're destabilising custom targets to allow us to move forward with
build-std without accidentally exposing functionality that we'd like
to revisit prior to committing to. I'll start a thread on Zulip to
discuss with the RfL team how we can come up with an alternative
for them."
Thus pass it.
Cc: David Wood <[email protected]>
Cc: Wesley Wiser <[email protected]>
Cc: [email protected] # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Link: rust-lang/rust#151534 [1]
Signed-off-by: Miguel Ojeda <[email protected]>
ojeda
added a commit
to ojeda/rust
that referenced
this pull request
Jan 27, 2026
…stom target specs This also takes the chance to move forward the job to Linux v6.19-rc7, thus the previous workaround is not needed anymore. Link: rust-lang#151534 Signed-off-by: Miguel Ojeda <[email protected]>
Contributor
|
Done -- could you please cherry-pick ojeda@c8656b7? I tested locally with your compiler branch, let's see if it works. |
…stom target specs This also takes the chance to move forward the job to Linux v6.19-rc7, thus the previous workaround is not needed anymore. Link: rust-lang#151534 Signed-off-by: Miguel Ojeda <[email protected]>
84f1eda to
2a9de6b
Compare
Member
|
@bors r=chenyukang |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 4, 2026
…json-again, r=chenyukang target: fix destabilising target-spec-json cc rust-lang#151528 rust-lang#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that. Closes rust-lang#71009
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 4, 2026
…json-again, r=chenyukang target: fix destabilising target-spec-json cc rust-lang#151528 rust-lang#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that. Closes rust-lang#71009
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 4, 2026
…json-again, r=chenyukang target: fix destabilising target-spec-json cc rust-lang#151528 rust-lang#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that. Closes rust-lang#71009
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
…uwer Rollup of 11 pull requests Successful merges: - #150605 (skip codegen for intrinsics with big fallback bodies if backend does not need them) - #150992 (link modifier `export-symbols`: export all global symbols from selected uptream c static libraries) - #151534 (target: fix destabilising target-spec-json) - #152088 (rustbook/README.md: add missing `)`) - #151526 (Fix autodiff codegen tests) - #151810 (citool: report debuginfo test statistics) - #152065 (Convert to inline diagnostics in `rustc_ty_utils`) - #152068 (Convert to inline diagnostics in `rustc_resolve`) - #152070 (Convert to inline diagnostics in `rustc_pattern_analysis`) - #152072 (Convert to inline diagnostics in `rustc_monomorphize`) - #152083 (Fix set_times_nofollow for directory on windows) Failed merges: - #152069 (Convert to inline diagnostics in `rustc_privacy`)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 4, 2026
…json-again, r=chenyukang target: fix destabilising target-spec-json cc rust-lang#151528 rust-lang#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that. Closes rust-lang#71009
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Feb 4, 2026
…json-again, r=chenyukang target: fix destabilising target-spec-json cc rust-lang#151528 rust-lang#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that. Closes rust-lang#71009
This was referenced Feb 4, 2026
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
…uwer Rollup of 12 pull requests Successful merges: - #150992 (link modifier `export-symbols`: export all global symbols from selected uptream c static libraries) - #151534 (target: fix destabilising target-spec-json) - #152088 (rustbook/README.md: add missing `)`) - #151526 (Fix autodiff codegen tests) - #151810 (citool: report debuginfo test statistics) - #151952 (Revert doc attribute parsing errors to future warnings) - #152065 (Convert to inline diagnostics in `rustc_ty_utils`) - #152066 (Convert to inline diagnostics in `rustc_session`) - #152069 (Convert to inline diagnostics in `rustc_privacy`) - #152072 (Convert to inline diagnostics in `rustc_monomorphize`) - #152083 (Fix set_times_nofollow for directory on windows) - #152102 (Convert to inline diagnostics in all codegen backends) Failed merges: - #152068 (Convert to inline diagnostics in `rustc_resolve`) - #152070 (Convert to inline diagnostics in `rustc_pattern_analysis`)
rust-timer
added a commit
that referenced
this pull request
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cc #151528
#150151 missed a case and didn't entirely destabilise target-spec-json - this patch corrects that.
Closes #71009