2015-11-12 15:50:58 -06:00
|
|
|
#![feature(rustc_private)]
|
|
|
|
|
2015-11-21 21:20:06 -06:00
|
|
|
extern crate miri;
|
2015-11-12 15:50:58 -06:00
|
|
|
extern crate rustc;
|
|
|
|
extern crate rustc_driver;
|
|
|
|
|
2015-11-21 21:20:06 -06:00
|
|
|
use miri::interpreter;
|
2015-11-12 15:50:58 -06:00
|
|
|
use rustc::session::Session;
|
|
|
|
use rustc_driver::{driver, CompilerCalls, Compilation};
|
|
|
|
|
|
|
|
struct MiriCompilerCalls;
|
|
|
|
|
|
|
|
impl<'a> CompilerCalls<'a> for MiriCompilerCalls {
|
|
|
|
fn build_controller(&mut self, _: &Session) -> driver::CompileController<'a> {
|
|
|
|
let mut control = driver::CompileController::basic();
|
|
|
|
control.after_analysis.stop = Compilation::Stop;
|
|
|
|
|
|
|
|
control.after_analysis.callback = Box::new(|state| {
|
2016-03-21 03:54:20 -05:00
|
|
|
state.session.abort_if_errors();
|
2015-11-12 15:50:58 -06:00
|
|
|
interpreter::interpret_start_points(state.tcx.unwrap(), state.mir_map.unwrap());
|
|
|
|
});
|
|
|
|
|
|
|
|
control
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let args: Vec<String> = std::env::args().collect();
|
|
|
|
rustc_driver::run_compiler(&args, &mut MiriCompilerCalls);
|
|
|
|
}
|