);
self.bencher.iter(|| {
- let config = miri::MiriConfig { validate: true, communicate: false, args: vec![], seed: None };
+ let config = miri::MiriConfig {
+ validate: true,
+ communicate: false,
+ args: vec![],
+ seed: None,
+ };
eval_main(tcx, entry_def_id, config);
});
});
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.check_name(syntax::symbol::sym::test)) {
- let config = MiriConfig { validate: true, communicate: false, args: vec![], seed: None };
+ let config = MiriConfig {
+ validate: true,
+ communicate: false,
+ args: vec![],
+ seed: None,
+ };
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, config);
tcx.hir().krate().visit_all_item_likes(&mut Visitor(tcx));
} else if let Some((entry_def_id, _)) = tcx.entry_fn(LOCAL_CRATE) {
- let config = MiriConfig { validate: true, communicate: false, args: vec![], seed: None };
+ let config = MiriConfig {
+ validate: true,
+ communicate: false,
+ args: vec![],
+ seed: None
+ };
miri::eval_main(tcx, entry_def_id, config);
compiler.session().abort_if_errors();
#[derive(Clone)]
pub struct MiriConfig {
pub validate: bool,
+ /// Determines if communication with the host environment is enabled.
pub communicate: bool,
pub args: Vec<String>,
- // The seed to use when non-determinism is required (e.g. getrandom())
+ /// The seed to use when non-determinism is required (e.g. getrandom())
pub seed: Option<u64>,
}
let mut ecx = InterpCx::new(
tcx.at(syntax::source_map::DUMMY_SP),
ty::ParamEnv::reveal_all(),
- Evaluator::new(),
+ Evaluator::new(config.communicate),
MemoryExtra::new(StdRng::seed_from_u64(config.seed.unwrap_or(0)), config.validate),
);
/// TLS state.
pub(crate) tls: TlsData<'tcx>,
+
+ /// If enabled, the `env_vars` field is populated with the host env vars during initialization.
+ pub(crate) communicate: bool,
}
impl<'tcx> Evaluator<'tcx> {
- pub(crate) fn new() -> Self {
+ pub(crate) fn new(communicate: bool) -> Self {
Evaluator {
env_vars: HashMap::default(),
argc: None,
cmd_line: None,
last_error: 0,
tls: TlsData::default(),
+ communicate,
}
}
}