about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-05-03 11:11:39 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-05-03 11:11:39 +0000
commitb1ebc552407d26874c15b1d5167d85cd063e32f6 (patch)
tree724dfe661d9347f7b49f7ccee27861f93395cc69
parent88d10687b003c97749306a64fc80d7fc89a6d959 (diff)
downloadrust-b1ebc552407d26874c15b1d5167d85cd063e32f6.tar.gz
rust-b1ebc552407d26874c15b1d5167d85cd063e32f6.zip
Correctly handle missing CG_CLIF_JIT_ARGS
-rw-r--r--src/config.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/config.rs b/src/config.rs
index 9e92d656c76..12bce680d9e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -64,8 +64,13 @@ impl Default for BackendConfig {
         BackendConfig {
             codegen_mode: CodegenMode::Aot,
             jit_args: {
-                let args = std::env::var("CG_CLIF_JIT_ARGS").unwrap_or_else(|_| String::new());
-                args.split(' ').map(|arg| arg.to_string()).collect()
+                match std::env::var("CG_CLIF_JIT_ARGS") {
+                    Ok(args) => args.split(' ').map(|arg| arg.to_string()).collect(),
+                    Err(std::env::VarError::NotPresent) => vec![],
+                    Err(std::env::VarError::NotUnicode(s)) => {
+                        panic!("CG_CLIF_JIT_ARGS not unicode: {:?}", s);
+                    }
+                }
             },
             enable_verifier: cfg!(debug_assertions) || bool_env_var("CG_CLIF_ENABLE_VERIFIER"),
             disable_incr_cache: bool_env_var("CG_CLIF_DISABLE_INCR_CACHE"),