rustc: Support --reproducible option for requesting reproducible output - #160448
rustc: Support --reproducible option for requesting reproducible output#160448petrochenkov wants to merge 1 commit into
--reproducible option for requesting reproducible output#160448Conversation
| @@ -0,0 +1,5 @@ | |||
| error: Argument to option 'reproducible' missing | |||
There was a problem hiding this comment.
enum OptionKind doesn't currently support optional arguments for top level options (i.e. both --reproducible and --reproducible=yes are supported).
It can be added later if it becomes necessary, but for now I just kept things as is.
|
Making diagnostics non-reproducible by default is probably fine., but I don't think we should ever make the compiled executable non-reproducible by default. |
|
To extend bjorn's remark, I think that a flag named Maybe the flag should be called The MCP shared a list of issues, some of which were said to produce irreproducible binary output. Have you looked more in detail into what causes these reproducibility issues, and whether there is really no way around that? There might be things that are not that important, e.g. alloc IDs (#154278), that perhaps could stay irreproducible, as long as the final binary output stays the same. |
|
The flag is definitely not just about diagnostics, but about binaries too. |
I know that the query design of rustc is rather unique, but if the only way to make frontend parallelization for rustc work is to make the compiler output non-deterministic/irreproducible kind of by design (of course there can always be edge cases, some paths being included in the binary by accident, bugs, etc.), then that is IMO a reason to take a step back and re-evaluate the used approach. That is why I was asking if the irreproducibility is really fundamental to the current design, or if it's "just" a matter of stomping out a set of bugs that are resolvable.
While I'm very excited for the parallel frontend to land, if it is not enabled by default, then IMO it would just be stabilization for stabilization's sake, and it won't have a large effect across the ecosystem. The default part is what's important, people can already opt in today via the unstable flag. If people have to explicitly opt in to get the build time wins, and choose reproducibility vs compiler speed-up, then that's not really a great outcome. Not to mention that stabilizing a Cargo config option might take some time.. x) |
The MCP rust-lang/compiler-team#1005 is written and I'm acting in assumption that the irreproducibility of the binaries is indeed fundamental, but also that the reproducibility doesn't matter in many common cases, and it would be a disservice to users to block the stabilization on it, or delay it for an indeterminate number of years. Once the parallel frontend is enabled on nightly I'll have time to debug the binary reproducibility issues and figure out how exactly fundamental they are, maybe some of them are actually fixable. I certainly agree that it would be good to fix them, just don't think that it should be a condition for stabilization.
This is a strange argument, considering that most of stabilized compiler and language feature do not do anything unless explicitly used.
Yes, and my goal is for them to opt in via a stable cargo config, or a stable rustc option in the interim.
I'm not actually sure that nonreproducible diagnostics are acceptable by default. That's why I think maybe it makes sense to implement the option as |
Well that situation isn't great, right? It should be enabled by default, unless everyone has to remember to set the flag correctly. Not to mention that This PR doesn't stabilize anything, so I won't block it or something, I just wanted to understand how bad are the reproducibility issues. Seems that it is pretty bad, based on what you wrote. Purely for practical reasons, since the goal here is to test stuff in the wild on nightly, I'm wondering whether having a
|
Ideally, I'd want to understand better why people have to disable parallel frontend.
... then the people will follow the recommendations, more or less, and we'll be able to collect better results by text search rather than relying on people bothering to report the reasons to us. Various rust-lang/rust test suites is the first place where I was going to use this distinction.
I hope that it survives, because |
If this wouldn't be the default, we did break basically every distro that tries to do reproducible builds instantly as well as Bazel, Buck2, ... And we did make verifying binaries for releases for everyone who hasn't added Also somewhat selfishly, it would break the release process for sudo-rs. (the release tag message contains hashes for locally built binaries and CI checks that it reproduces those exact hashes before creating the release) |
Do you mean we won't be able to start the 3 month nightly testing as described in the MCP? A bit of archeology - back when the parallel compiler was done in separate builds ( |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Updated the option to accept |
Follow up to #159675.
Part of rust-lang/compiler-team#1005.
r? @bjorn3