Skip to content

Commit

Permalink
Auto merge of #118442 - tmiasko:fuel-inc, r=lqd
Browse files Browse the repository at this point in the history
-Zfuel is incompatible with incremental compilation
  • Loading branch information
bors committed Dec 8, 2023
2 parents 370c911 + 1a47e41 commit d6fa38a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
22 changes: 11 additions & 11 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2121,16 +2121,6 @@ fn should_override_cgus_and_disable_thinlto(
(disable_local_thinlto, codegen_units)
}

fn check_thread_count(handler: &EarlyErrorHandler, unstable_opts: &UnstableOptions) {
if unstable_opts.threads == 0 {
handler.early_error("value for threads must be a positive non-zero integer");
}

if unstable_opts.threads > 1 && unstable_opts.fuel.is_some() {
handler.early_error("optimization fuel is incompatible with multiple threads");
}
}

fn collect_print_requests(
handler: &EarlyErrorHandler,
cg: &mut CodegenOptions,
Expand Down Expand Up @@ -2646,7 +2636,17 @@ pub fn build_session_options(
let (disable_local_thinlto, mut codegen_units) =
should_override_cgus_and_disable_thinlto(handler, &output_types, matches, cg.codegen_units);

check_thread_count(handler, &unstable_opts);
if unstable_opts.threads == 0 {
handler.early_error("value for threads must be a positive non-zero integer");
}

let fuel = unstable_opts.fuel.is_some() || unstable_opts.print_fuel.is_some();
if fuel && unstable_opts.threads > 1 {
handler.early_error("optimization fuel is incompatible with multiple threads");
}
if fuel && cg.incremental.is_some() {
handler.early_error("optimization fuel is incompatible with incremental compilation");
}

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

Expand Down
11 changes: 11 additions & 0 deletions tests/ui/invalid-compile-flags/fuel.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// revisions: incremental threads
// dont-check-compiler-stderr
//
// [threads] compile-flags: -Zfuel=a=1 -Zthreads=2
// [threads] error-pattern:optimization fuel is incompatible with multiple threads
//
// [incremental] incremental
// [incremental] compile-flags: -Zprint-fuel=a
// [incremental] error-pattern:optimization fuel is incompatible with incremental compilation

fn main() {}

0 comments on commit d6fa38a

Please sign in to comment.