Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 8, 2019
1 parent 9109c43 commit 3266063
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions benches/helpers/miri_helper.rs
Expand Up @@ -4,11 +4,13 @@ extern crate rustc;
extern crate rustc_driver;
extern crate test;

use self::miri::eval_main;
use self::rustc_driver::{driver, Compilation};
use rustc_driver::{driver, Compilation};
use rustc::hir::def_id::LOCAL_CRATE;
use std::cell::RefCell;
use std::rc::Rc;

use miri::{MiriConfig, eval_main};

use crate::test::Bencher;

pub struct MiriCompilerCalls<'a>(Rc<RefCell<&'a mut Bencher>>);
Expand Down Expand Up @@ -50,7 +52,8 @@ pub fn run(filename: &str, bencher: &mut Bencher) {
);

bencher.borrow_mut().iter(|| {
eval_main(tcx, entry_def_id, false);
let config = MiriConfig { validate: true, args: vec![] };
eval_main(tcx, entry_def_id, config);
});

state.session.abort_if_errors();
Expand Down
8 changes: 6 additions & 2 deletions src/bin/miri-rustc-tests.rs
Expand Up @@ -25,6 +25,8 @@ use rustc::ty::TyCtxt;
use syntax::ast;
use rustc::hir::def_id::LOCAL_CRATE;

use miri::MiriConfig;

struct MiriCompilerCalls {
default: Box<RustcDefaultCalls>,
/// whether we are building for the host
Expand Down Expand Up @@ -94,9 +96,10 @@ fn after_analysis<'a, 'tcx>(state: &mut CompileState<'a, 'tcx>) {
fn visit_item(&mut self, i: &'hir hir::Item) {
if let hir::ItemKind::Fn(.., body_id) = i.node {
if i.attrs.iter().any(|attr| attr.name() == "test") {
let config = MiriConfig { validate: true, args: vec![] };
let did = self.0.hir().body_owner_def_id(body_id);
println!("running test: {}", self.0.def_path_debug_str(did));
miri::eval_main(self.0, did, /*validate*/true);
miri::eval_main(self.0, did, config);
self.1.session.abort_if_errors();
}
}
Expand All @@ -106,7 +109,8 @@ fn after_analysis<'a, 'tcx>(state: &mut CompileState<'a, 'tcx>) {
}
state.hir_crate.unwrap().visit_all_item_likes(&mut Visitor(tcx, state));
} else if let Some((entry_def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
miri::eval_main(tcx, entry_def_id, /*validate*/true);
let config = MiriConfig { validate: true, args: vec![] };
miri::eval_main(tcx, entry_def_id, config);

state.session.abort_if_errors();
} else {
Expand Down

0 comments on commit 3266063

Please sign in to comment.