diff --git a/src/shims/sync.rs b/src/shims/sync.rs index 39a087dc9a..8986455a14 100644 --- a/src/shims/sync.rs +++ b/src/shims/sync.rs @@ -316,7 +316,7 @@ fn release_cond_mutex_and_block<'mir, 'tcx: 'mir>( active_thread: ThreadId, mutex: MutexId, ) -> InterpResult<'tcx> { - if let Some(old_locked_count) = ecx.mutex_unlock(mutex, active_thread)? { + if let Some(old_locked_count) = ecx.mutex_unlock(mutex, active_thread) { if old_locked_count != 1 { throw_unsup_format!("awaiting on a lock acquired multiple times is not supported"); } @@ -486,7 +486,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx let id = mutex_get_or_create_id(this, mutex_op)?; let active_thread = this.get_active_thread(); - if let Some(_old_locked_count) = this.mutex_unlock(id, active_thread)? { + if let Some(_old_locked_count) = this.mutex_unlock(id, active_thread) { // The mutex was locked by the current thread. Ok(0) } else { diff --git a/src/sync.rs b/src/sync.rs index 5ba29b5afa..0d4b4d6b7c 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -153,14 +153,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx &mut self, id: MutexId, expected_owner: ThreadId, - ) -> InterpResult<'tcx, Option> { + ) -> Option { let this = self.eval_context_mut(); let mutex = &mut this.machine.threads.sync.mutexes[id]; if let Some(current_owner) = mutex.owner { // Mutex is locked. if current_owner != expected_owner { // Only the owner can unlock the mutex. - return Ok(None); + return None; } let old_lock_count = mutex.lock_count; mutex.lock_count = old_lock_count @@ -172,10 +172,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx // to another thread. this.mutex_dequeue_and_lock(id); } - Ok(Some(old_lock_count)) + Some(old_lock_count) } else { // Mutex is unlocked. - Ok(None) + None } }