about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-01-24 22:42:42 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-01-24 22:42:42 +0100
commit12e73aec910ba8ad6fc673cacf7d5138523c8d30 (patch)
treec0a3e76b2f996282035c681dab5167fc1108d30b
parent549158123c1ceecd0f23807a53ff4b3c780407d2 (diff)
downloadrust-12e73aec910ba8ad6fc673cacf7d5138523c8d30.tar.gz
rust-12e73aec910ba8ad6fc673cacf7d5138523c8d30.zip
Fix `--use-system-gcc` option handling
-rw-r--r--build_system/src/config.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/build_system/src/config.rs b/build_system/src/config.rs
index 0904ea871cd..4f9fcc97151 100644
--- a/build_system/src/config.rs
+++ b/build_system/src/config.rs
@@ -320,12 +320,16 @@ impl ConfigInfo {
     ) -> Result<(), String> {
         env.insert("CARGO_INCREMENTAL".to_string(), "0".to_string());
 
-        if self.gcc_path.is_none() && !use_system_gcc {
-            self.setup_gcc_path()?;
-        }
-        let gcc_path = self.gcc_path.clone().expect(
-            "The config module should have emitted an error if the GCC path wasn't provided",
-        );
+        let gcc_path = if !use_system_gcc {
+            if self.gcc_path.is_none() {
+                self.setup_gcc_path()?;
+            }
+            self.gcc_path.clone().expect(
+                "The config module should have emitted an error if the GCC path wasn't provided",
+            )
+        } else {
+            String::new()
+        };
         env.insert("GCC_PATH".to_string(), gcc_path.clone());
 
         if self.cargo_target_dir.is_empty() {