diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2023-12-08 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2023-12-08 00:00:00 +0000 |
| commit | 1a47e413b2e3ad25fa6cf99465ae8dbd48b595cb (patch) | |
| tree | 424a70ed53e6e7f15458e98a3df77621aa27cb48 | |
| parent | a73d1bf6313e4126bedf8fa3ed14ffbea94d8513 (diff) | |
| download | rust-1a47e413b2e3ad25fa6cf99465ae8dbd48b595cb.tar.gz rust-1a47e413b2e3ad25fa6cf99465ae8dbd48b595cb.zip | |
Fuel is incompatible with incremental compilation
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 6 | ||||
| -rw-r--r-- | tests/ui/invalid-compile-flags/fuel.rs | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index b431c6b9213..1ea3ab0d5ec 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -2640,9 +2640,13 @@ pub fn build_session_options( handler.early_error("value for threads must be a positive non-zero integer"); } - if unstable_opts.threads > 1 && unstable_opts.fuel.is_some() { + 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); diff --git a/tests/ui/invalid-compile-flags/fuel.rs b/tests/ui/invalid-compile-flags/fuel.rs new file mode 100644 index 00000000000..456bc47d359 --- /dev/null +++ b/tests/ui/invalid-compile-flags/fuel.rs @@ -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() {} |
