Soft disable incremental

This disables incremental (i.e., -Cincremental) taking effect unless an
environment variable, RUSTC_FORCE_INCREMENTAL, is set to 1 in the environment of
the running rustc. Currently incremental causes errors for many users, and we do
not have an expectation of being able to quickly fix these errors in a
backportable way - so, for now, disable incremental entirely. The user can still
opt-in, but this way the majority of users merely get slower builds, not broken
builds.
This commit is contained in:
Mark Rousskov 2021-05-08 20:30:54 -04:00
parent 88f19c6dab
commit 4e62503598
3 changed files with 23 additions and 3 deletions

View file

@ -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(

View file

@ -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

View file

@ -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();
@ -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,