Skip to content

Commit

Permalink
Auto merge of #85097 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
[stable] 1.52.1 release

Note that this may not be the version we end up going with. However, in the interests of having the artifacts available should we choose to use them, this PR will prepare a set of artifacts which:

* Disables incremental compilation unless the user has explicitly opted in (via an environment variable, for ease of setting it globally)
* Adds the improved error message which tells the user how to workaround the breakage, intended for users who do explicitly re-enable incremental

Note that the release notes mark Monday as the release date; I think it is likely that if we choose to go down this path we should indeed release on Monday, and potentially follow up in a week or two (e.g., May 20th) with a 1.52.2 if we have confidence in some collection of fixes. I think this will be unlikely, though.

Please also note that this PR breaks normal policy by landing commits/work **only** on the stable branch. It is my intent to follow up with PRs toward beta and master, as well, but in the interests of making sure we have artifacts as early as possible I am posting this first. It will also let us provide an ask for testing, via the dev-static bucket, sooner rather than later.
  • Loading branch information
bors committed May 9, 2021
2 parents 88f19c6 + a0190b5 commit 9bc8c42
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 5 deletions.
21 changes: 21 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
Version 1.52.1 (2021-05-10)
============================

This release disables incremental compilation, unless the user has explicitly
opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.

This is due to the widespread, and frequently occuring, breakage encountered by
Rust users due to newly enabled incremental verification in 1.52.0. Notably,
Rust users **should** upgrade to 1.52.0 or 1.52.1: the bugs that are detected by
newly added incremental verification are still present in past stable versions,
and are not yet fixed on any channel. These bugs can lead to miscompilation of
Rust binaries.

These problems only affect incremental builds, so release builds with Cargo
should not be affected unless the user has explicitly opted into incremental.
Debug and check builds are affected.

See [84970] for more details.

[84970]: https://github.com/rust-lang/rust/issues/84970

Version 1.52.0 (2021-05-06)
============================

Expand Down
14 changes: 13 additions & 1 deletion compiler/rustc_query_system/src/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,19 @@ fn incremental_verify_ich<CTX, K, V: Debug>(

let old_hash = tcx.dep_graph().fingerprint_of(dep_node_index);

assert!(new_hash == old_hash, "found unstable fingerprints for {:?}: {:?}", dep_node, result);
if new_hash != old_hash {
let run_cmd = if let Some(crate_name) = &tcx.sess().opts.crate_name {
format!("`cargo clean -p {}` or `cargo clean`", crate_name)
} else {
"`cargo clean`".to_string()
};
tcx.sess().struct_err(&format!("internal compiler error: encountered incremental compilation error with {:?}", dep_node))
.help(&format!("This is a known issue with the compiler. Run {} to allow your project to compile", run_cmd))
.note(&format!("Please follow the instructions below to create a bug report with the provided information"))
.note(&format!("See <https://github.com/rust-lang/rust/issues/84970> for more information."))
.emit();
panic!("Found unstable fingerprints for {:?}: {:?}", dep_node, result);
}
}

fn force_query_with_job<C, CTX>(
Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,12 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {

check_thread_count(&debugging_opts, error_format);

let incremental = cg.incremental.as_ref().map(PathBuf::from);
let incremental =
if std::env::var_os("RUSTC_FORCE_INCREMENTAL").map(|v| v == "1").unwrap_or(false) {
cg.incremental.as_ref().map(PathBuf::from)
} else {
None
};

if debugging_opts.profile && incremental.is_some() {
early_error(
Expand Down
3 changes: 3 additions & 0 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ to save information after compiling a crate to be reused when recompiling the
crate, improving re-compile times. This takes a path to a directory where
incremental files will be stored.

Note that this option currently does not take effect unless
`RUSTC_FORCE_INCREMENTAL=1` in the environment.

## inline-threshold

This option lets you set the default threshold for inlining a function. It
Expand Down
16 changes: 14 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,15 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
print!("\n\n");
}
debug!("running {:?}", testpaths.file.display());
let props = TestProps::from_file(&testpaths.file, revision, &config);
let mut props = TestProps::from_file(&testpaths.file, revision, &config);

// Currently, incremental is soft disabled unless this environment
// variable is set. A bunch of our tests assume it's enabled, though - so
// just enable it for our tests.
//
// This is deemed preferable to ignoring those tests; we still want to test
// incremental somewhat, as users can opt in to it.
props.rustc_env.push((String::from("RUSTC_FORCE_INCREMENTAL"), String::from("1")));

let cx = TestCx { config: &config, props: &props, testpaths, revision };
create_dir_all(&cx.output_base_dir()).unwrap();
Expand All @@ -240,7 +248,11 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
assert!(!props.revisions.is_empty(), "Incremental tests require revisions.");
cx.init_incremental_test();
for revision in &props.revisions {
let revision_props = TestProps::from_file(&testpaths.file, Some(revision), &config);
let mut revision_props = TestProps::from_file(&testpaths.file, Some(revision), &config);
// See above - need to enable it explicitly for now.
revision_props
.rustc_env
.push((String::from("RUSTC_FORCE_INCREMENTAL"), String::from("1")));
let rev_cx = TestCx {
config: &config,
props: &revision_props,
Expand Down
2 changes: 1 addition & 1 deletion src/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.52.0
1.52.1

0 comments on commit 9bc8c42

Please sign in to comment.