Allow supplying an error destination via the compiler driver

Allows replacing stderr with a buffer from the client.

Also, some refactoring around run_compiler.
This commit is contained in:
Nick Cameron 2016-09-27 11:45:50 +13:00
parent 322b5530ba
commit e8a4db25ac
6 changed files with 56 additions and 33 deletions

View file

@ -79,8 +79,8 @@ fn main() {
format!("_ _ --sysroot {} --crate-type dylib", path.to_str().unwrap())
.split(' ').map(|s| s.to_string()).collect();
let (result, _) = rustc_driver::run_compiler_with_file_loader(
&args, &mut JitCalls, box JitLoader);
let (result, _) = rustc_driver::run_compiler(
&args, &mut JitCalls, Some(box JitLoader), None);
if let Err(n) = result {
panic!("Error {}", n);
}

View file

@ -86,6 +86,6 @@ fn main() {
let mut tc = TestCalls { count: 1 };
// we should never get use this filename, but lets make sure they are valid args.
let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()];
rustc_driver::run_compiler(&args, &mut tc);
rustc_driver::run_compiler(&args, &mut tc, None, None);
assert_eq!(tc.count, 30);
}