-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
allow overwriting the output of rustc --version
#124339
Conversation
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
@rfcbot merge |
Team member @oli-obk has proposed to merge this. The next step is review by the rest of the tagged team members:
Concerns:
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
This comment has been minimized.
This comment has been minimized.
I have a few concerns with this approach:
|
ffbf62c
to
3c75940
Compare
We already have |
3c75940
to
b961660
Compare
Some changes occurred in src/tools/compiletest cc @jieyouxu |
I read the description, but I still don't understand what is |
I'm a little...lost here. Digging around, if I understand correctly: The proposed policy in this FCP is to not just discourage this use but actively prevent it? That definitely seems a bit too far for me. I think it definitely makes sense to treat the compilers as "stable" when bisecting - particularly because we don't have any guarantees of stability for nightly features. I also think it might be worth thinking about why things like (edit: seems like I was not the only one confused) |
Adding a flag to tell It should help with a (sufficient?) subset of the problematic cases that the PR initially wanted to address. There will be cases where the bisection will be for crates using nightly features and a combination of those cases + incorrect rust version checking will continue to manifest the problem of bisecting making crates like +1 on landing |
version_check::supports_feature
on nightlyrustc --version
I expanded the main PR description. |
That has the opposite effect of what I'm proposing, as it endorses nightly detection. Nightly detection is absolutely incompatible with semver. It means that users testing their stable crate on nightly to be aware of upcoming changes get random failures from crates that work fine on stable. |
I appreciate the desire by crate authors to make things "just work™️", but it would be much better for the |
Requires rust-lang/rust#124339 but drastically simplifies evading nightly-detection
One thing I'd like is a way to say "Print whatever |
You can't1 actually do this, since cargo swallows the output from build scripts. Footnotes |
cargo doesn't swallow stderr IIRC. |
ca49432
to
44f63d6
Compare
This comment was marked as resolved.
This comment was marked as resolved.
@bors r=wesleywiser |
@bors rollup=iffy |
allow overwriting the output of `rustc --version` Our wonderful bisection folk [have to work around](rust-lang#123276 (comment)) crates that do incomplete nightly/feature detection, as otherwise the bisection just points to where the feature detection breaks, and not to the actual breakage they are looking for. This is also annoying behaviour to nightly users who did not opt-in to those nightly features. Most nightly users want to be in control of the nightly breakage they get, by * choosing when to update rustc * choosing when to update dependencies * choosing which nightly features they are willing to take the breakage for The reason this breakage occurs is that the build script of some crates run `rustc --version`, and if the version looks like nightly or dev, it will enable nightly features. These nightly features may break in random ways whenever we change something in nightly, so every release of such a crate will only work with a small range of nightly releases. This causes bisection to fail whenever it tries an unsupported nightly, even though that crate is not related to the bisection at all, but is just an unrelated dependency. This PR (and the policy I want to establish with this FCP) is only for situations like the `version_check`'s `supports_feature` function. It is explicitly not for `autocfg` or similar feature-detection-by-building-rust-code, irrespective of my opinions on it and the similarity of nightly breakage that can occur with such schemes. These cause much less breakage, but should the breakage become an issue, they should get covered by this policy, too. This PR allows changing the version and release strings reported by `rustc --version` via the `RUSTC_OVERRIDE_VERSION_STRING` env var. The bisection issue is then fixed by rust-lang/cargo-bisect-rustc#335. I mainly want to establish a compiler team policy: > We do not consider feature detection on nightly (on stable via compiler version numbering is fine) a valid use case that we need to support, and if it causes problems, we are at liberty to do what we deem best - either actively working to prevent it or to actively ignore it. We may try to work with responsive and cooperative authors, but are not obligated to. Should they subvert the workarounds that nightly users or cargo-bisect-rustc can use, we should be able to land rustc PRs that target the specific crates that cause issues for us and outright replace their build script's logic to disable nightly detection. I am not including links to crates, PRs or issues here, as I don't actually care about the specific use cases and don't want to make it trivial to go there and leave comments. This discussion is going to be interesting enough on its own, without branching out.
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
44f63d6
to
92f263b
Compare
@bors r=wesleywiser |
☀️ Test successful - checks-actions |
Finished benchmarking commit (006c8df): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -2.8%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 768.761s -> 769.469s (0.09%) |
Our wonderful bisection folk have to work around crates that do incomplete nightly/feature detection, as otherwise the bisection just points to where the feature detection breaks, and not to the actual breakage they are looking for.
This is also annoying behaviour to nightly users who did not opt-in to those nightly features. Most nightly users want to be in control of the nightly breakage they get, by
The reason this breakage occurs is that the build script of some crates run
rustc --version
, and if the version looks like nightly or dev, it will enable nightly features. These nightly features may break in random ways whenever we change something in nightly, so every release of such a crate will only work with a small range of nightly releases. This causes bisection to fail whenever it tries an unsupported nightly, even though that crate is not related to the bisection at all, but is just an unrelated dependency.This PR (and the policy I want to establish with this FCP) is only for situations like the
version_check
'ssupports_feature
function. It is explicitly not forautocfg
or similar feature-detection-by-building-rust-code, irrespective of my opinions on it and the similarity of nightly breakage that can occur with such schemes. These cause much less breakage, but should the breakage become an issue, they should get covered by this policy, too.This PR allows changing the version and release strings reported by
rustc --version
via theRUSTC_OVERRIDE_VERSION_STRING
env var. The bisection issue is then fixed by rust-lang/cargo-bisect-rustc#335.I mainly want to establish a compiler team policy:
Should they subvert the workarounds that nightly users or cargo-bisect-rustc can use, we should be able to land rustc PRs that target the specific crates that cause issues for us and outright replace their build script's logic to disable nightly detection.
I am not including links to crates, PRs or issues here, as I don't actually care about the specific use cases and don't want to make it trivial to go there and leave comments. This discussion is going to be interesting enough on its own, without branching out.