From 9af2a285b15b33490c314d9ba30df91aa23b87cf Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Sat, 13 Jan 2024 09:14:26 +0200 Subject: [PATCH] Fix build on Darwin --- core/io/darwin.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/io/darwin.rs b/core/io/darwin.rs index 9643902b7..578263813 100644 --- a/core/io/darwin.rs +++ b/core/io/darwin.rs @@ -1,5 +1,6 @@ use super::Completion; use anyhow::{Ok, Result}; +use std::sync::Arc; use std::cell::RefCell; use std::io::{Read, Seek}; @@ -30,11 +31,12 @@ impl File { pub fn pread(&self, pos: usize, c: Arc) -> Result<()> { let mut file = self.file.borrow_mut(); file.seek(std::io::SeekFrom::Start(pos as u64))?; - let buf = c.buf(); - let mut buf = buf.as_mut_slice(); - file.read_exact(buf)?; - drop(buf); + { + let mut buf = c.buf_mut(); + let buf = buf.as_mut_slice(); + file.read_exact(buf)?; + } c.complete(); Ok(()) } -} \ No newline at end of file +}