-
Notifications
You must be signed in to change notification settings - Fork 13.6k
rustdoc: save target modifiers #144523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
rustdoc: save target modifiers #144523
+53
−0
Conversation
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
rustbot has assigned @GuillaumeGomez. Use |
This comment has been minimized.
This comment has been minimized.
This was referenced Jul 6, 2025
3bcb62d
to
7eff864
Compare
This PR modifies cc @jieyouxu |
Added a test and removed the @user. |
This comment has been minimized.
This comment has been minimized.
`rustdoc` was filling a `target_modifiers` variable, but it was not using the result. In turn, that means that trying to use a dependency that set a target modifier fails. For instance, running: ```sh RUSTC_BOOTSTRAP=1 rustc --edition=2024 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null --emit=metadata -Zfixed-x18 --crate-type rlib --crate-name core $(rustc --print sysroot)/lib/rustlib/src/rust/library/core/src/lib.rs echo '#![allow(internal_features)] ' | RUSTC_BOOTSTRAP=1 rustdoc --edition=2021 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null -Zfixed-x18 --extern core=libcore.rmeta - ``` will fail with: ```text error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error ``` Thus save the targets modifiers in `Options` to then pass it to the session options, so that eventually the diff can be performed as expected in `report_incompatible_target_modifiers()`. Fixes: rust-lang#144521 Signed-off-by: Miguel Ojeda <[email protected]>
7eff864
to
558796b
Compare
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Jul 27, 2025
Starting with Rust 1.88.0 (released 2025-06-26), `rustdoc` complains about a target modifier mismatch in configurations where `-Zfixed-x18` is passed: error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error The reason is that `rustdoc` was not passing the target modifiers when configuring the session options, and thus it would report a mismatch that did not exist as soon as a target modifier is used in a dependency. We did not notice it in the kernel until now because `-Zfixed-x18` has been a target modifier only since 1.88.0 (and it is the only one we use so far). The issue has been reported upstream [1] and a fix has been submitted [2], including a test similar to the kernel case. Meanwhile, conditionally pass `-Cunsafe-allow-abi-mismatch=fixed-x18` to workaround the issue on our side. Reported-by: Konrad Dybcio <[email protected]> Closes: https://lore.kernel.org/rust-for-linux/[email protected]/ Link: rust-lang/rust#144521 [1] Link: rust-lang/rust#144523 [2] Signed-off-by: Miguel Ojeda <[email protected]>
ojeda
added a commit
to ojeda/linux
that referenced
this pull request
Jul 27, 2025
Starting with Rust 1.88.0 (released 2025-06-26), `rustdoc` complains about a target modifier mismatch in configurations where `-Zfixed-x18` is passed: error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error The reason is that `rustdoc` was not passing the target modifiers when configuring the session options, and thus it would report a mismatch that did not exist as soon as a target modifier is used in a dependency. We did not notice it in the kernel until now because `-Zfixed-x18` has been a target modifier only since 1.88.0 (and it is the only one we use so far). The issue has been reported upstream [1] and a fix has been submitted [2], including a test similar to the kernel case. Meanwhile, conditionally pass `-Cunsafe-allow-abi-mismatch=fixed-x18` to workaround the issue on our side. Reported-by: Konrad Dybcio <[email protected]> Closes: https://lore.kernel.org/rust-for-linux/[email protected]/ Link: rust-lang/rust#144521 [1] Link: rust-lang/rust#144523 [2] Signed-off-by: Miguel Ojeda <[email protected]>
GuillaumeGomez
approved these changes
Jul 27, 2025
Nice, thanks! @bors r+ rollup |
intel-lab-lkp
pushed a commit
to intel-lab-lkp/linux
that referenced
this pull request
Jul 27, 2025
Starting with Rust 1.88.0 (released 2025-06-26), `rustdoc` complains about a target modifier mismatch in configurations where `-Zfixed-x18` is passed: error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error The reason is that `rustdoc` was not passing the target modifiers when configuring the session options, and thus it would report a mismatch that did not exist as soon as a target modifier is used in a dependency. We did not notice it in the kernel until now because `-Zfixed-x18` has been a target modifier only since 1.88.0 (and it is the only one we use so far). The issue has been reported upstream [1] and a fix has been submitted [2], including a test similar to the kernel case. Meanwhile, conditionally pass `-Cunsafe-allow-abi-mismatch=fixed-x18` to workaround the issue on our side. Reported-by: Konrad Dybcio <[email protected]> Closes: https://lore.kernel.org/rust-for-linux/[email protected]/ Link: rust-lang/rust#144521 [1] Link: rust-lang/rust#144523 [2] Signed-off-by: Miguel Ojeda <[email protected]>
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jul 27, 2025
…GuillaumeGomez rustdoc: save target modifiers `rustdoc` was filling a `target_modifiers` variable, but it was not using the result. In turn, that means that trying to use a dependency that set a target modifier fails. For instance, running: ```sh RUSTC_BOOTSTRAP=1 rustc --edition=2024 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null --emit=metadata -Zfixed-x18 --crate-type rlib --crate-name core $(rustc --print sysroot)/lib/rustlib/src/rust/library/core/src/lib.rs echo '#![allow(internal_features)] ' | RUSTC_BOOTSTRAP=1 rustdoc --edition=2021 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null -Zfixed-x18 --extern core=libcore.rmeta - ``` will fail with: ```text error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error ``` Thus save the targets modifiers in `Options` to then pass it to the session options, so that eventually the diff can be performed as expected in `report_incompatible_target_modifiers()`. Cc: `@azhogin` Fixes: rust-lang#144521
bors
added a commit
that referenced
this pull request
Jul 27, 2025
Rollup of 7 pull requests Successful merges: - #143289 (Remove `[T]::array_chunks(_mut)`) - #143607 (Port the proc macro attributes to the new attribute parsing infrastructure) - #144471 (Remove `compiler-builtins-{no-asm,mangled-names}`) - #144495 (bump cargo_metadata) - #144523 (rustdoc: save target modifiers) - #144534 (check_static_item: explain should_check_for_sync choices) - #144535 (miri: for ABI mismatch errors, say which argument is the problem) Failed merges: - #144536 (miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
that referenced
this pull request
Jul 28, 2025
Rollup of 6 pull requests Successful merges: - #143607 (Port the proc macro attributes to the new attribute parsing infrastructure) - #144471 (Remove `compiler-builtins-{no-asm,mangled-names}`) - #144495 (bump cargo_metadata) - #144523 (rustdoc: save target modifiers) - #144534 (check_static_item: explain should_check_for_sync choices) - #144535 (miri: for ABI mismatch errors, say which argument is the problem) Failed merges: - #144536 (miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Jul 28, 2025
Rollup merge of #144523 - ojeda:rustdoc-target-modifiers, r=GuillaumeGomez rustdoc: save target modifiers `rustdoc` was filling a `target_modifiers` variable, but it was not using the result. In turn, that means that trying to use a dependency that set a target modifier fails. For instance, running: ```sh RUSTC_BOOTSTRAP=1 rustc --edition=2024 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null --emit=metadata -Zfixed-x18 --crate-type rlib --crate-name core $(rustc --print sysroot)/lib/rustlib/src/rust/library/core/src/lib.rs echo '#![allow(internal_features)] ' | RUSTC_BOOTSTRAP=1 rustdoc --edition=2021 --target=aarch64-unknown-none-softfloat --sysroot=/dev/null -Zfixed-x18 --extern core=libcore.rmeta - ``` will fail with: ```text error: mixing `-Zfixed-x18` will cause an ABI mismatch in crate `rust_out` | = help: the `-Zfixed-x18` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely = note: unset `-Zfixed-x18` in this crate is incompatible with `-Zfixed-x18=` in dependency `core` = help: set `-Zfixed-x18=` in this crate or unset `-Zfixed-x18` in `core` = help: if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch=fixed-x18` to silence this error ``` Thus save the targets modifiers in `Options` to then pass it to the session options, so that eventually the diff can be performed as expected in `report_incompatible_target_modifiers()`. Cc: ``@azhogin`` Fixes: #144521
Thanks for the quick review! |
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this pull request
Jul 28, 2025
Rollup of 6 pull requests Successful merges: - rust-lang/rust#143607 (Port the proc macro attributes to the new attribute parsing infrastructure) - rust-lang/rust#144471 (Remove `compiler-builtins-{no-asm,mangled-names}`) - rust-lang/rust#144495 (bump cargo_metadata) - rust-lang/rust#144523 (rustdoc: save target modifiers) - rust-lang/rust#144534 (check_static_item: explain should_check_for_sync choices) - rust-lang/rust#144535 (miri: for ABI mismatch errors, say which argument is the problem) Failed merges: - rust-lang/rust#144536 (miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Jul 30, 2025
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#143607 (Port the proc macro attributes to the new attribute parsing infrastructure) - rust-lang#144471 (Remove `compiler-builtins-{no-asm,mangled-names}`) - rust-lang#144495 (bump cargo_metadata) - rust-lang#144523 (rustdoc: save target modifiers) - rust-lang#144534 (check_static_item: explain should_check_for_sync choices) - rust-lang#144535 (miri: for ABI mismatch errors, say which argument is the problem) Failed merges: - rust-lang#144536 (miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
github-actions bot
pushed a commit
to rust-lang/stdarch
that referenced
this pull request
Jul 31, 2025
Rollup of 6 pull requests Successful merges: - rust-lang/rust#143607 (Port the proc macro attributes to the new attribute parsing infrastructure) - rust-lang/rust#144471 (Remove `compiler-builtins-{no-asm,mangled-names}`) - rust-lang/rust#144495 (bump cargo_metadata) - rust-lang/rust#144523 (rustdoc: save target modifiers) - rust-lang/rust#144534 (check_static_item: explain should_check_for_sync choices) - rust-lang/rust#144535 (miri: for ABI mismatch errors, say which argument is the problem) Failed merges: - rust-lang/rust#144536 (miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-run-make
Area: port run-make Makefiles to rmake.rs
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
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.
rustdoc
was filling atarget_modifiers
variable, but it was not using the result.In turn, that means that trying to use a dependency that set a target modifier fails.
For instance, running:
will fail with:
Thus save the targets modifiers in
Options
to then pass it to the session options, so that eventually the diff can be performed as expected inreport_incompatible_target_modifiers()
.Cc: @azhogin
Fixes: #144521