-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rustdoc: when merging target features, keep the highest stability #137632
Conversation
rustbot has assigned @workingjubilee. Use |
Cc @rust-lang/rustdoc |
I haven't added a test as I am not sure how to build one... is it even possible to have a |
😵💫 does rustdoc even respond to things like |
I suppose it must or core wouldn't work but I'm not feeling entirely sure right now... |
Given this is fixing a stable-to-stable regression I feel it's okay to land this without a test... though if a rustdoc person has an idea for how to test this that would of course be great. :) |
I'm not even sure to understand what needs to be checked in rustdoc. From reading the issue, what I see is that it failed compilation. What do you want to check in rustdoc? |
It fails compilation only in rustdoc and only on ARM-32 targets. So we'd need a test that checks that some code builds fine in rustdoc on ARM-32. Ideally this test can be run on all hosts, which we usually do with |
Do we have an equivalent test for rustc? If so you can write the same one for rustdoc. |
The rustc test would be something like
So do I just dump such a file into |
In |
This comment has been minimized.
This comment has been minimized.
Hm that does not seem to do the right thing, the test passes even without my PR. |
Okay strange, of the two examples given in #137366, only one reproduces this way. 🤷 I guess one confirmed test is enough. ;) |
b072867
to
eff59b8
Compare
This comment has been minimized.
This comment has been minimized.
eff59b8
to
6b63c57
Compare
Ah, right, the The last commit disables this check in rustdoc. It also adds a test. |
This comment has been minimized.
This comment has been minimized.
6b63c57
to
63088e3
Compare
if !tcx.sess.opts.actually_rustdoc { | ||
if abi_feature_constraints.incompatible.contains(&name.as_str()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this just &&
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name
is a Symbol
. So &&name
does not work, no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was commenting on both lines because I meant that this is &&
the control flow operator:
if x {
if y {
};
};
if x && y {
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's what you meant.^^
Yeah you are right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's already rolled up so I'll rather not push to this PR.
@@ -0,0 +1,28 @@ | |||
//! This is a regression test for <https://github.com/rust-lang/rust/issues/137366>, ensuring | |||
//! that we can use the `neon` target feature on ARM-32 targets in rustdoc despite there |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! that we can use the `neon` target feature on ARM-32 targets in rustdoc despite there | |
//! that we can use the `neon` target feature on ARM32 targets in rustdoc despite there |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with nits addressed
Nominating for backport as #137366 is a stable-to-stable regression. |
…r=workingjubilee rustdoc: when merging target features, keep the highest stability This addresses rust-lang#137366. (Not closing since we might consider a backport.) rustdoc wants to pretend that it runs for all targets at once and has all target features, so `tcx.rust_target_features()` will actually be all the target features. For target features that exist on multiple targets, the stability info for one of the targets will be picked (first or last in the list, I guess). All the code consuming that query has to be aware that the data is basically nonsense when running in rustdoc, but the logic checking for unstable or forbidden `#[target_feature]` attributes was not aware of that. This PR makes the `tcx.rust_target_features()` info in rustdoc slightly less nonsensical (and decidedly less random) by having the "most stable" target feature take precedent. That deals with rust-lang#137366 (a conflict between a stable and a "forbidden" target feature of the same name for different targets), and also deals with the situation (that we did not seem to have yet) of a conflict between a stable and an unstable target feature of the same name. Note that if there are two unstable target features of the same name, rustdoc might still require the "wrong" nightly feature to be enabled -- but this can only possibly affect unstable code so I guess we can wait until that actually happens, and then someone will have to rewrite this entire thing to be less hacky.
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#136865 (Perform deeper compiletest path normalization for `$TEST_BUILD_DIR` to account for compare-mode/debugger cases, and normalize long type file filename hashes) - rust-lang#136922 (Pattern types: Avoid having to handle an Option for range ends in the type system or the HIR) - rust-lang#137081 (change config.toml to bootstrap.toml) - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) Failed merges: - rust-lang#137147 (Add exclude to config.toml) r? `@ghost` `@rustbot` modify labels: rollup
…r=workingjubilee rustdoc: when merging target features, keep the highest stability This addresses rust-lang#137366. (Not closing since we might consider a backport.) rustdoc wants to pretend that it runs for all targets at once and has all target features, so `tcx.rust_target_features()` will actually be all the target features. For target features that exist on multiple targets, the stability info for one of the targets will be picked (first or last in the list, I guess). All the code consuming that query has to be aware that the data is basically nonsense when running in rustdoc, but the logic checking for unstable or forbidden `#[target_feature]` attributes was not aware of that. This PR makes the `tcx.rust_target_features()` info in rustdoc slightly less nonsensical (and decidedly less random) by having the "most stable" target feature take precedent. That deals with rust-lang#137366 (a conflict between a stable and a "forbidden" target feature of the same name for different targets), and also deals with the situation (that we did not seem to have yet) of a conflict between a stable and an unstable target feature of the same name. Note that if there are two unstable target features of the same name, rustdoc might still require the "wrong" nightly feature to be enabled -- but this can only possibly affect unstable code so I guess we can wait until that actually happens, and then someone will have to rewrite this entire thing to be less hacky.
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#136865 (Perform deeper compiletest path normalization for `$TEST_BUILD_DIR` to account for compare-mode/debugger cases, and normalize long type file filename hashes) - rust-lang#137081 (change config.toml to bootstrap.toml) - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) r? `@ghost` `@rustbot` modify labels: rollup
…r=workingjubilee rustdoc: when merging target features, keep the highest stability This addresses rust-lang#137366. (Not closing since we might consider a backport.) rustdoc wants to pretend that it runs for all targets at once and has all target features, so `tcx.rust_target_features()` will actually be all the target features. For target features that exist on multiple targets, the stability info for one of the targets will be picked (first or last in the list, I guess). All the code consuming that query has to be aware that the data is basically nonsense when running in rustdoc, but the logic checking for unstable or forbidden `#[target_feature]` attributes was not aware of that. This PR makes the `tcx.rust_target_features()` info in rustdoc slightly less nonsensical (and decidedly less random) by having the "most stable" target feature take precedent. That deals with rust-lang#137366 (a conflict between a stable and a "forbidden" target feature of the same name for different targets), and also deals with the situation (that we did not seem to have yet) of a conflict between a stable and an unstable target feature of the same name. Note that if there are two unstable target features of the same name, rustdoc might still require the "wrong" nightly feature to be enabled -- but this can only possibly affect unstable code so I guess we can wait until that actually happens, and then someone will have to rewrite this entire thing to be less hacky.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#136865 (Perform deeper compiletest path normalization for `$TEST_BUILD_DIR` to account for compare-mode/debugger cases, and normalize long type file filename hashes) - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#137103 ({json|html}docck: catch and error on deprecated syntax) - rust-lang#137632 (rustdoc: when merging target features, keep the highest stability) - rust-lang#137684 (Add rustdoc support for `--emit=dep-info[=path]`) - rust-lang#137794 (make qnx pass a test) - rust-lang#137801 (tests: Unignore target modifier tests on all platforms) - rust-lang#137826 (test(codegen): add looping_over_ne_bytes test for rust-lang#133528) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137632 - RalfJung:rustdoc-target-features, r=workingjubilee rustdoc: when merging target features, keep the highest stability This addresses rust-lang#137366. (Not closing since we might consider a backport.) rustdoc wants to pretend that it runs for all targets at once and has all target features, so `tcx.rust_target_features()` will actually be all the target features. For target features that exist on multiple targets, the stability info for one of the targets will be picked (first or last in the list, I guess). All the code consuming that query has to be aware that the data is basically nonsense when running in rustdoc, but the logic checking for unstable or forbidden `#[target_feature]` attributes was not aware of that. This PR makes the `tcx.rust_target_features()` info in rustdoc slightly less nonsensical (and decidedly less random) by having the "most stable" target feature take precedent. That deals with rust-lang#137366 (a conflict between a stable and a "forbidden" target feature of the same name for different targets), and also deals with the situation (that we did not seem to have yet) of a conflict between a stable and an unstable target feature of the same name. Note that if there are two unstable target features of the same name, rustdoc might still require the "wrong" nightly feature to be enabled -- but this can only possibly affect unstable code so I guess we can wait until that actually happens, and then someone will have to rewrite this entire thing to be less hacky.
backport: rust-lang/rust#137632 to fix cross compilation of docs
hey @rust-lang/rustdoc Are you interested (or neutral or against) in having this patch backported to beta channel. It fixes a regression on stable. |
(t-rustdoc backport nomination thread is #t-rustdoc > beta-nominated: #137632) |
This addresses #137366. (Not closing since we might consider a backport.)
rustdoc wants to pretend that it runs for all targets at once and has all target features, so
tcx.rust_target_features()
will actually be all the target features. For target features that exist on multiple targets, the stability info for one of the targets will be picked (first or last in the list, I guess). All the code consuming that query has to be aware that the data is basically nonsense when running in rustdoc, but the logic checking for unstable or forbidden#[target_feature]
attributes was not aware of that.This PR makes the
tcx.rust_target_features()
info in rustdoc slightly less nonsensical (and decidedly less random) by having the "most stable" target feature take precedent. That deals with #137366 (a conflict between a stable and a "forbidden" target feature of the same name for different targets), and also deals with the situation (that we did not seem to have yet) of a conflict between a stable and an unstable target feature of the same name. Note that if there are two unstable target features of the same name, rustdoc might still require the "wrong" nightly feature to be enabled -- but this can only possibly affect unstable code so I guess we can wait until that actually happens, and then someone will have to rewrite this entire thing to be less hacky.