- let path = std::env::var("RUST_SYSROOT").expect("env variable `RUST_SYSROOT` not set");
- rustc_driver::run_compiler(&[
- "miri".to_string(), "benches/smoke_helper.rs".to_string(), "--sysroot".to_string(), path.to_string(),
- ], &mut MiriCompilerCalls(Rc::new(RefCell::new(bencher))));
-}
-
-struct MiriCompilerCalls<'a>(Rc<RefCell<&'a mut Bencher>>);
-
-impl<'a> CompilerCalls<'a> for MiriCompilerCalls<'a> {
- fn build_controller(
- &mut self,
- _: &Session,
- _: &getopts::Matches
- ) -> driver::CompileController<'a> {
- let mut control: driver::CompileController<'a> = driver::CompileController::basic();
-
- let bencher = self.0.clone();
-
- control.after_analysis.callback = Box::new(move |state| {
- state.session.abort_if_errors();
- bencher.borrow_mut().iter(|| {
- interpreter::interpret_start_points(state.tcx.unwrap(), state.mir_map.unwrap());
- })
- });
-
- control
- }