Skip to content

Commit d6fa38a

Browse files
committed
Auto merge of #118442 - tmiasko:fuel-inc, r=lqd
-Zfuel is incompatible with incremental compilation
2 parents 370c911 + 1a47e41 commit d6fa38a

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

compiler/rustc_session/src/config.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -2121,16 +2121,6 @@ fn should_override_cgus_and_disable_thinlto(
21212121
(disable_local_thinlto, codegen_units)
21222122
}
21232123

2124-
fn check_thread_count(handler: &EarlyErrorHandler, unstable_opts: &UnstableOptions) {
2125-
if unstable_opts.threads == 0 {
2126-
handler.early_error("value for threads must be a positive non-zero integer");
2127-
}
2128-
2129-
if unstable_opts.threads > 1 && unstable_opts.fuel.is_some() {
2130-
handler.early_error("optimization fuel is incompatible with multiple threads");
2131-
}
2132-
}
2133-
21342124
fn collect_print_requests(
21352125
handler: &EarlyErrorHandler,
21362126
cg: &mut CodegenOptions,
@@ -2646,7 +2636,17 @@ pub fn build_session_options(
26462636
let (disable_local_thinlto, mut codegen_units) =
26472637
should_override_cgus_and_disable_thinlto(handler, &output_types, matches, cg.codegen_units);
26482638

2649-
check_thread_count(handler, &unstable_opts);
2639+
if unstable_opts.threads == 0 {
2640+
handler.early_error("value for threads must be a positive non-zero integer");
2641+
}
2642+
2643+
let fuel = unstable_opts.fuel.is_some() || unstable_opts.print_fuel.is_some();
2644+
if fuel && unstable_opts.threads > 1 {
2645+
handler.early_error("optimization fuel is incompatible with multiple threads");
2646+
}
2647+
if fuel && cg.incremental.is_some() {
2648+
handler.early_error("optimization fuel is incompatible with incremental compilation");
2649+
}
26502650

26512651
let incremental = cg.incremental.as_ref().map(PathBuf::from);
26522652

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// revisions: incremental threads
2+
// dont-check-compiler-stderr
3+
//
4+
// [threads] compile-flags: -Zfuel=a=1 -Zthreads=2
5+
// [threads] error-pattern:optimization fuel is incompatible with multiple threads
6+
//
7+
// [incremental] incremental
8+
// [incremental] compile-flags: -Zprint-fuel=a
9+
// [incremental] error-pattern:optimization fuel is incompatible with incremental compilation
10+
11+
fn main() {}

0 commit comments

Comments
 (0)