diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2014-05-15 19:28:46 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2014-05-18 22:56:19 +0200 |
| commit | eb6856c307ae8cff97c57f11be2cf04561e7f2eb (patch) | |
| tree | 9c54337e46e8de105349df1db874a3ed5370198f /src/compiletest | |
| parent | 63287eef27b1a23a1fc24a7b4453eb7bd8ec1f11 (diff) | |
| download | rust-eb6856c307ae8cff97c57f11be2cf04561e7f2eb.tar.gz rust-eb6856c307ae8cff97c57f11be2cf04561e7f2eb.zip | |
Fixing rustdoc stage1.
See #13983 and #14000. Fix was originally authored by alexcrichton and then rebased a couple times by pnkfelix, most recently atop PR 13954. ---- Regarding the change to librustdoc/lib.rs, to do `map_err` before unwrapping a `TqskResult`: I do not understand how master is passing without this change or something like it, since `Box<Any:Send>` does not implement `Show`. (Is this something that is only a problem for the snapshot stage0 compiler?) Still, the change I have put in here (which was added as part of a rebase after alex's review) seems harmless to me to apply to rustdoc at all stages, since a call to `unwrap` is just going to `fail!` on the err case anyway.
Diffstat (limited to 'src/compiletest')
| -rw-r--r-- | src/compiletest/procsrv.rs | 61 |
1 files changed, 19 insertions, 42 deletions
diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 9f62fd7096c..6b273c2d463 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -11,54 +11,31 @@ use std::os; use std::str; use std::io::process::{ProcessExit, Command, Process, ProcessOutput}; +use std::unstable::dynamic_lib::DynamicLibrary; -#[cfg(target_os = "win32")] fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf, StrBuf)> { - let env = os::env(); + let prog = if cfg!(windows) {prog.slice_to(prog.len() - 4)} else {prog}; + let aux_path = prog + ".libaux"; - // 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"; + // Need to be sure to put both the lib_path and the aux path in the dylib + // search path for the child. + let mut path = DynamicLibrary::search_path(); + path.insert(0, Path::new(aux_path)); + path.insert(0, Path::new(lib_path)); - let mut new_env: Vec<_> = env.move_iter().map(|(k, v)| { - let new_v = if "PATH" == k { - format_strbuf!("{};{};{}", v, lib_path, aux_path) - } else { - v.to_strbuf() - }; - (k.to_strbuf(), new_v) - }).collect(); - if prog.ends_with("rustc.exe") { - new_env.push(("RUST_THREADS".to_strbuf(), "1".to_strbuf())); + // Remove the previous dylib search path var + let var = DynamicLibrary::envvar(); + let mut env: Vec<(StrBuf,StrBuf)> = + os::env().move_iter().map(|(a,b)|(a.to_strbuf(), b.to_strbuf())).collect(); + match env.iter().position(|&(ref k, _)| k.as_slice() == var) { + Some(i) => { env.remove(i); } + None => {} } - return new_env; -} -#[cfg(target_os = "linux")] -#[cfg(target_os = "macos")] -#[cfg(target_os = "freebsd")] -fn target_env(lib_path: &str, prog: &str) -> Vec<(StrBuf,StrBuf)> { - // Make sure we include the aux directory in the path - let aux_path = prog + ".libaux"; - - let mut env: Vec<(StrBuf,StrBuf)> = - os::env().move_iter() - .map(|(ref k, ref v)| (k.to_strbuf(), v.to_strbuf())) - .collect(); - let var = if cfg!(target_os = "macos") { - "DYLD_LIBRARY_PATH" - } else { - "LD_LIBRARY_PATH" - }; - let prev = match env.iter().position(|&(ref k, _)| k.as_slice() == var) { - Some(i) => env.remove(i).unwrap().val1(), - None => "".to_strbuf(), - }; - env.push((var.to_strbuf(), if prev.is_empty() { - format_strbuf!("{}:{}", lib_path, aux_path) - } else { - format_strbuf!("{}:{}:{}", lib_path, aux_path, prev) - })); + // Add the new dylib search path var + let newpath = DynamicLibrary::create_path(path.as_slice()); + env.push((var.to_strbuf(), + str::from_utf8(newpath.as_slice()).unwrap().to_strbuf())); return env; } |
