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 +}