-
Notifications
You must be signed in to change notification settings - Fork 385
/
Copy pathmiri.rs
31 lines (24 loc) · 844 Bytes
/
miri.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#![feature(rustc_private, custom_attribute)]
#![allow(unused_attributes)]
extern crate miri;
extern crate rustc;
extern crate rustc_driver;
use miri::interpreter;
use rustc::session::Session;
use rustc_driver::{driver, CompilerCalls};
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.callback = Box::new(|state| {
state.session.abort_if_errors();
interpreter::interpret_start_points(state.tcx.unwrap(), state.mir_map.unwrap());
});
control
}
}
#[miri_run]
fn main() {
let args: Vec<String> = std::env::args().collect();
rustc_driver::run_compiler(&args, &mut MiriCompilerCalls);
}