make MPlaceTy non-Copy
This commit is contained in:
parent
77ff1b83cd
commit
da3f0d0eb7
11 changed files with 28 additions and 28 deletions
|
|
@ -600,14 +600,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
/// necessary.
|
||||
fn last_error_place(&mut self) -> InterpResult<'tcx, MPlaceTy<'tcx, Provenance>> {
|
||||
let this = self.eval_context_mut();
|
||||
if let Some(errno_place) = this.active_thread_ref().last_error {
|
||||
Ok(errno_place)
|
||||
if let Some(errno_place) = this.active_thread_ref().last_error.as_ref() {
|
||||
Ok(errno_place.clone())
|
||||
} else {
|
||||
// Allocate new place, set initial value to 0.
|
||||
let errno_layout = this.machine.layouts.u32;
|
||||
let errno_place = this.allocate(errno_layout, MiriMemoryKind::Machine.into())?;
|
||||
this.write_scalar(Scalar::from_u32(0), &errno_place)?;
|
||||
this.active_thread_mut().last_error = Some(errno_place);
|
||||
this.active_thread_mut().last_error = Some(errno_place.clone());
|
||||
Ok(errno_place)
|
||||
}
|
||||
}
|
||||
|
|
@ -725,7 +725,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
|
||||
let mplace = MPlaceTy::from_aligned_ptr(ptr, layout);
|
||||
|
||||
this.check_mplace(mplace)?;
|
||||
this.check_mplace(&mplace)?;
|
||||
|
||||
Ok(mplace)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
|
|||
Self::add_extern_static(
|
||||
this,
|
||||
"environ",
|
||||
this.machine.env_vars.environ.unwrap().ptr,
|
||||
this.machine.env_vars.environ.as_ref().unwrap().ptr,
|
||||
);
|
||||
// A couple zero-initialized pointer-sized extern statics.
|
||||
// Most of them are for weak symbols, which we all set to null (indicating that the
|
||||
|
|
@ -685,7 +685,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
|
|||
Self::add_extern_static(
|
||||
this,
|
||||
"environ",
|
||||
this.machine.env_vars.environ.unwrap().ptr,
|
||||
this.machine.env_vars.environ.as_ref().unwrap().ptr,
|
||||
);
|
||||
}
|
||||
"android" => {
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ impl<'tcx> EnvVars<'tcx> {
|
|||
ecx.deallocate_ptr(ptr, None, MiriMemoryKind::Runtime.into())?;
|
||||
}
|
||||
// Deallocate environ var list.
|
||||
let environ = ecx.machine.env_vars.environ.unwrap();
|
||||
let old_vars_ptr = ecx.read_pointer(&environ)?;
|
||||
let environ = ecx.machine.env_vars.environ.as_ref().unwrap();
|
||||
let old_vars_ptr = ecx.read_pointer(environ)?;
|
||||
ecx.deallocate_ptr(old_vars_ptr, None, MiriMemoryKind::Runtime.into())?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -431,8 +431,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
fn update_environ(&mut self) -> InterpResult<'tcx> {
|
||||
let this = self.eval_context_mut();
|
||||
// Deallocate the old environ list, if any.
|
||||
if let Some(environ) = this.machine.env_vars.environ {
|
||||
let old_vars_ptr = this.read_pointer(&environ)?;
|
||||
if let Some(environ) = this.machine.env_vars.environ.as_ref() {
|
||||
let old_vars_ptr = this.read_pointer(environ)?;
|
||||
this.deallocate_ptr(old_vars_ptr, None, MiriMemoryKind::Runtime.into())?;
|
||||
} else {
|
||||
// No `environ` allocated yet, let's do that.
|
||||
|
|
@ -459,7 +459,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
let place = this.project_field(&vars_place, idx)?;
|
||||
this.write_pointer(var, &place)?;
|
||||
}
|
||||
this.write_pointer(vars_place.ptr, &this.machine.env_vars.environ.unwrap())?;
|
||||
this.write_pointer(vars_place.ptr, &this.machine.env_vars.environ.clone().unwrap())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
|||
"_NSGetEnviron" => {
|
||||
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||
this.write_pointer(
|
||||
this.machine.env_vars.environ.expect("machine must be initialized").ptr,
|
||||
this.machine.env_vars.environ.as_ref().expect("machine must be initialized").ptr,
|
||||
dest,
|
||||
)?;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue