Skip to content

Commit 9bc8c42

Browse files
committed
Auto merge of #85097 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[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.
2 parents 88f19c6 + a0190b5 commit 9bc8c42

File tree

6 files changed

+58
-5
lines changed

6 files changed

+58
-5
lines changed

RELEASES.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
Version 1.52.1 (2021-05-10)
2+
============================
3+
4+
This release disables incremental compilation, unless the user has explicitly
5+
opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
6+
7+
This is due to the widespread, and frequently occuring, breakage encountered by
8+
Rust users due to newly enabled incremental verification in 1.52.0. Notably,
9+
Rust users **should** upgrade to 1.52.0 or 1.52.1: the bugs that are detected by
10+
newly added incremental verification are still present in past stable versions,
11+
and are not yet fixed on any channel. These bugs can lead to miscompilation of
12+
Rust binaries.
13+
14+
These problems only affect incremental builds, so release builds with Cargo
15+
should not be affected unless the user has explicitly opted into incremental.
16+
Debug and check builds are affected.
17+
18+
See [84970] for more details.
19+
20+
[84970]: https://github.com/rust-lang/rust/issues/84970
21+
122
Version 1.52.0 (2021-05-06)
223
============================
324

compiler/rustc_query_system/src/query/plumbing.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,19 @@ fn incremental_verify_ich<CTX, K, V: Debug>(
590590

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

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

596608
fn force_query_with_job<C, CTX>(

compiler/rustc_session/src/config.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,12 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
18851885

18861886
check_thread_count(&debugging_opts, error_format);
18871887

1888-
let incremental = cg.incremental.as_ref().map(PathBuf::from);
1888+
let incremental =
1889+
if std::env::var_os("RUSTC_FORCE_INCREMENTAL").map(|v| v == "1").unwrap_or(false) {
1890+
cg.incremental.as_ref().map(PathBuf::from)
1891+
} else {
1892+
None
1893+
};
18891894

18901895
if debugging_opts.profile && incremental.is_some() {
18911896
early_error(

src/doc/rustc/src/codegen-options/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ to save information after compiling a crate to be reused when recompiling the
161161
crate, improving re-compile times. This takes a path to a directory where
162162
incremental files will be stored.
163163

164+
Note that this option currently does not take effect unless
165+
`RUSTC_FORCE_INCREMENTAL=1` in the environment.
166+
164167
## inline-threshold
165168

166169
This option lets you set the default threshold for inlining a function. It

src/tools/compiletest/src/runtest.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,15 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
229229
print!("\n\n");
230230
}
231231
debug!("running {:?}", testpaths.file.display());
232-
let props = TestProps::from_file(&testpaths.file, revision, &config);
232+
let mut props = TestProps::from_file(&testpaths.file, revision, &config);
233+
234+
// Currently, incremental is soft disabled unless this environment
235+
// variable is set. A bunch of our tests assume it's enabled, though - so
236+
// just enable it for our tests.
237+
//
238+
// This is deemed preferable to ignoring those tests; we still want to test
239+
// incremental somewhat, as users can opt in to it.
240+
props.rustc_env.push((String::from("RUSTC_FORCE_INCREMENTAL"), String::from("1")));
233241

234242
let cx = TestCx { config: &config, props: &props, testpaths, revision };
235243
create_dir_all(&cx.output_base_dir()).unwrap();
@@ -240,7 +248,11 @@ pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) {
240248
assert!(!props.revisions.is_empty(), "Incremental tests require revisions.");
241249
cx.init_incremental_test();
242250
for revision in &props.revisions {
243-
let revision_props = TestProps::from_file(&testpaths.file, Some(revision), &config);
251+
let mut revision_props = TestProps::from_file(&testpaths.file, Some(revision), &config);
252+
// See above - need to enable it explicitly for now.
253+
revision_props
254+
.rustc_env
255+
.push((String::from("RUSTC_FORCE_INCREMENTAL"), String::from("1")));
244256
let rev_cx = TestCx {
245257
config: &config,
246258
props: &revision_props,

src/version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.52.0
1+
1.52.1

0 commit comments

Comments
 (0)