]> git.lizzy.rs Git - rust.git/commitdiff
move env var stuff out of the miri lib
authorRalf Jung <post@ralfj.de>
Fri, 4 Jan 2019 14:37:51 +0000 (15:37 +0100)
committerRalf Jung <post@ralfj.de>
Fri, 4 Jan 2019 14:37:51 +0000 (15:37 +0100)
src/bin/miri.rs
src/lib.rs

index c2255d706339d8d6556f79ea8f1e492cff3709de..d8d7cfe0702e5673ede65541f458a20cba639199 100644 (file)
@@ -154,6 +154,14 @@ fn init_late_loggers() {
             rustc_driver::init_rustc_env_logger();
         }
     }
+
+    // If MIRI_BACKTRACE is set and RUST_CTFE_BACKTRACE is not, set RUST_CTFE_BACKTRACE.
+    // Do this late, so we really only apply this to miri's errors.
+    if let Ok(var) = env::var("MIRI_BACKTRACE") {
+        if env::var("RUST_CTFE_BACKTRACE") == Err(env::VarError::NotPresent) {
+            env::set_var("RUST_CTFE_BACKTRACE", &var);
+        }
+    }
 }
 
 fn find_sysroot() -> String {
index 7643f93fdc2cf63ad34c4a1a8064e02062e2a352..bb6c9e3ca503fb27b4f495bd17d4b9b3a773e5a4 100644 (file)
@@ -15,7 +15,6 @@
 
 use std::collections::HashMap;
 use std::borrow::Cow;
-use std::env;
 
 use rustc::ty::{self, TyCtxt, query::TyCtxtAt};
 use rustc::ty::layout::{TyLayout, LayoutOf, Size, Align};
@@ -184,14 +183,6 @@ pub fn eval_main<'a, 'tcx: 'a>(
 ) {
     let mut ecx = create_ecx(tcx, main_id, validate).expect("Couldn't create ecx");
 
-    // If MIRI_BACKTRACE is set and RUST_CTFE_BACKTRACE is not, set RUST_CTFE_BACKTRACE.
-    // Do this late, so we really only apply this to miri's errors.
-    if let Ok(var) = env::var("MIRI_BACKTRACE") {
-        if env::var("RUST_CTFE_BACKTRACE") == Err(env::VarError::NotPresent) {
-            env::set_var("RUST_CTFE_BACKTRACE", &var);
-        }
-    }
-
     // Run! The main execution.
     let res: EvalResult = (|| {
         ecx.run()?;