Replace run_compiler with RunCompiler builder pattern.

RunCompiler::new takes non-optional params, and optional
params can be set using set_*field_name* method.
finally `run` will forward all fields to `run_compiler`.
This commit is contained in:
Darshan Kathiriya 2020-10-07 09:09:59 -03:00
parent ccea570488
commit e8dca789a1
3 changed files with 50 additions and 12 deletions

View file

@ -26,13 +26,8 @@ fn main() {
let mut count = 1;
let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()];
rustc_driver::catch_fatal_errors(|| {
rustc_driver::run_compiler(
&args,
&mut TestCalls { count: &mut count },
None,
None,
None,
).ok();
}).ok();
rustc_driver::RunCompiler::new(&args, &mut TestCalls { count: &mut count }).run().ok();
})
.ok();
assert_eq!(count, 2);
}