diff options
| author | Ralf Jung <post@ralfj.de> | 2023-07-25 22:35:07 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-07-25 22:35:07 +0200 |
| commit | da3f0d0eb7ced3d4967dcac01ddd2edef8f43b85 (patch) | |
| tree | 0e08e8b822bbf9def79446e844cb41fb756a9842 /src/tools | |
| parent | 77ff1b83cd3279c348312e1e1f9bf6a1c1174178 (diff) | |
| download | rust-da3f0d0eb7ced3d4967dcac01ddd2edef8f43b85.tar.gz rust-da3f0d0eb7ced3d4967dcac01ddd2edef8f43b85.zip | |
make MPlaceTy non-Copy
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/miri/src/helpers.rs | 8 | ||||
| -rw-r--r-- | src/tools/miri/src/machine.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/env.rs | 10 | ||||
| -rw-r--r-- | src/tools/miri/src/shims/unix/macos/foreign_items.rs | 2 |
4 files changed, 12 insertions, 12 deletions
diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index 928bee48356..d41bcc978b0 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -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) } diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index 8d24d9748bf..0c9c072b051 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -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" => { diff --git a/src/tools/miri/src/shims/env.rs b/src/tools/miri/src/shims/env.rs index 3d1dfb426cd..3694ea51da6 100644 --- a/src/tools/miri/src/shims/env.rs +++ b/src/tools/miri/src/shims/env.rs @@ -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(()) } diff --git a/src/tools/miri/src/shims/unix/macos/foreign_items.rs b/src/tools/miri/src/shims/unix/macos/foreign_items.rs index 7ab1b3dfdb2..3673ca5aee3 100644 --- a/src/tools/miri/src/shims/unix/macos/foreign_items.rs +++ b/src/tools/miri/src/shims/unix/macos/foreign_items.rs @@ -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, )?; } |
