]> git.lizzy.rs Git - rust.git/commitdiff
compiletest: Fix bitrotted win32 routines
authorklutzy <klutzytheklutzy@gmail.com>
Tue, 1 Apr 2014 07:10:56 +0000 (16:10 +0900)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 3 Apr 2014 20:42:58 +0000 (13:42 -0700)
src/compiletest/procsrv.rs
src/compiletest/runtest.rs

index e00b864f2e9ebf892d4deab3467911edceefe250..34918e391828955b021afe8955db842bf4f68fe4 100644 (file)
 use std::io::process::{ProcessExit, Process, ProcessConfig, ProcessOutput};
 
 #[cfg(target_os = "win32")]
-fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
-
-    let mut env = os::env();
+fn target_env(lib_path: &str, prog: &str) -> Vec<(~str, ~str)> {
+    let env = os::env();
 
     // Make sure we include the aux directory in the path
     assert!(prog.ends_with(".exe"));
     let aux_path = prog.slice(0u, prog.len() - 4u).to_owned() + ".libaux";
 
-    env = env.map(|pair| {
-        let (k,v) = (*pair).clone();
-        if k == ~"PATH" { (~"PATH", v + ";" + lib_path + ";" + aux_path) }
-        else { (k,v) }
-    });
+    let mut new_env: Vec<_> = env.move_iter().map(|(k, v)| {
+        let new_v = if "PATH" == k {
+            format!("{};{};{}", v, lib_path, aux_path)
+        } else {
+            v
+        };
+        (k, new_v)
+    }).collect();
     if prog.ends_with("rustc.exe") {
-        env.push((~"RUST_THREADS", ~"1"));
+        new_env.push((~"RUST_THREADS", ~"1"));
     }
-    return env;
+    return new_env;
 }
 
 #[cfg(target_os = "linux")]
index b07588a914d12bed0c36b3d97fbacc0f0b37cc8f..e057909a06cd01c27981b7ca9da5f9a14b7f2277 100644 (file)
@@ -529,7 +529,7 @@ fn to_lower( s : &str ) -> ~str {
                 c
             }
         } ).collect();
-        str::from_chars( c )
+        str::from_chars(c.as_slice())
     }
 
     #[cfg(target_os = "win32")]