#[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())
- pub seed: Option<u64>
+ /// The seed to use when non-determinism is required (e.g. getrandom())
+ pub seed: Option<u64>,
}
// Used by priroda.
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),
);
let main_mir = ecx.load_mir(main_instance.def)?;
if !main_mir.return_ty().is_unit() || main_mir.arg_count != 0 {
- throw_unsup!(Unimplemented(
+ throw_unsup_format!(
"miri does not support main functions without `fn()` type signatures"
- .to_owned(),
- ));
+ );
}
let start_id = tcx.lang_items().start_fn().unwrap();
let start_mir = ecx.load_mir(start_instance.def)?;
if start_mir.arg_count != 3 {
- throw_unsup!(AbiViolation(format!(
+ bug!(
"'start' lang item should have three arguments, but has {}",
start_mir.arg_count
- )));
+ );
}
// Return value (in static memory so that it does not count as leak).
cur_ptr = cur_ptr.offset(char_size, tcx)?;
}
}
-
+
assert!(args.next().is_none(), "start lang item has more arguments than expected");
Ok(ecx)