X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fmachine.rs;h=ed9a8a1c46346f320149b1a9e473cbc56e3e124a;hb=068c448832c466e3eb6297125a12e5a83a450e2d;hp=7fa79d822c35b6763758e46127c56475ac0aa4b0;hpb=d0e88502673a359786147d54166d5f35b391178e;p=rust.git diff --git a/src/machine.rs b/src/machine.rs index 7fa79d822c3..ed9a8a1c463 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -93,10 +93,13 @@ pub struct Evaluator<'tcx> { /// 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, @@ -104,6 +107,7 @@ pub(crate) fn new() -> Self { cmd_line: None, last_error: 0, tls: TlsData::default(), + communicate, } } } @@ -141,6 +145,8 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> { const STATIC_KIND: Option = Some(MiriMemoryKind::Static); + const CHECK_ALIGN: bool = true; + #[inline(always)] fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool { ecx.memory().extra.validate @@ -247,9 +253,7 @@ fn find_foreign_static( let data = vec![0; size.bytes() as usize]; Allocation::from_bytes(&data, tcx.data_layout.pointer_align.abi) } - _ => throw_unsup!(Unimplemented( - format!("can't access foreign static: {}", link_name), - )), + _ => throw_unsup_format!("can't access foreign static: {}", link_name), }; Ok(Cow::Owned(alloc)) }