| 1 |
Index: sqlx-core/Cargo.toml |
| 2 |
=================================================================== |
| 3 |
--- sqlx-core.orig/Cargo.toml |
| 4 |
+++ sqlx-core/Cargo.toml |
| 5 |
@@ -27,7 +27,7 @@ repository = "https://github.com/launchb |
| 6 |
features = ["offline"] |
| 7 |
|
| 8 |
[dependencies.async-io] |
| 9 |
-version = "1.9.0" |
| 10 |
+version = ">= 1.9.0" |
| 11 |
optional = true |
| 12 |
|
| 13 |
[dependencies.async-std] |
| 14 |
Index: sqlx-core/src/lib.rs |
| 15 |
=================================================================== |
| 16 |
--- sqlx-core.orig/src/lib.rs |
| 17 |
+++ sqlx-core/src/lib.rs |
| 18 |
@@ -17,7 +17,7 @@ |
| 19 |
#![allow(clippy::needless_doctest_main, clippy::type_complexity)] |
| 20 |
// The only unsafe code in SQLx is that necessary to interact with native APIs like with SQLite, |
| 21 |
// and that can live in its own separate driver crate. |
| 22 |
-#![forbid(unsafe_code)] |
| 23 |
+//#![forbid(unsafe_code)] disabled due to async-io update. |
| 24 |
// Allows an API be documented as only available in some specific platforms. |
| 25 |
// <https://doc.rust-lang.org/unstable-book/language-features/doc-cfg.html> |
| 26 |
#![cfg_attr(docsrs, feature(doc_cfg))] |
| 27 |
Index: sqlx-core/src/rt/rt_async_std/socket.rs |
| 28 |
=================================================================== |
| 29 |
--- sqlx-core.orig/src/rt/rt_async_std/socket.rs |
| 30 |
+++ sqlx-core/src/rt/rt_async_std/socket.rs |
| 31 |
@@ -11,11 +11,15 @@ use async_io::Async; |
| 32 |
|
| 33 |
impl Socket for Async<TcpStream> { |
| 34 |
fn try_read(&mut self, buf: &mut dyn ReadBuf) -> io::Result<usize> { |
| 35 |
+ unsafe { |
| 36 |
self.get_mut().read(buf.init_mut()) |
| 37 |
+ } |
| 38 |
} |
| 39 |
|
| 40 |
fn try_write(&mut self, buf: &[u8]) -> io::Result<usize> { |
| 41 |
+ unsafe { |
| 42 |
self.get_mut().write(buf) |
| 43 |
+ } |
| 44 |
} |
| 45 |
|
| 46 |
fn poll_read_ready(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>> { |
| 47 |
@@ -27,18 +31,24 @@ impl Socket for Async<TcpStream> { |
| 48 |
} |
| 49 |
|
| 50 |
fn poll_shutdown(&mut self, _cx: &mut Context<'_>) -> Poll<io::Result<()>> { |
| 51 |
+ unsafe { |
| 52 |
Poll::Ready(self.get_mut().shutdown(Shutdown::Both)) |
| 53 |
+ } |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
#[cfg(unix)] |
| 58 |
impl Socket for Async<std::os::unix::net::UnixStream> { |
| 59 |
fn try_read(&mut self, buf: &mut dyn ReadBuf) -> io::Result<usize> { |
| 60 |
+ unsafe { |
| 61 |
self.get_mut().read(buf.init_mut()) |
| 62 |
+ } |
| 63 |
} |
| 64 |
|
| 65 |
fn try_write(&mut self, buf: &[u8]) -> io::Result<usize> { |
| 66 |
+ unsafe { |
| 67 |
self.get_mut().write(buf) |
| 68 |
+ } |
| 69 |
} |
| 70 |
|
| 71 |
fn poll_read_ready(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>> { |
| 72 |
@@ -46,10 +56,12 @@ impl Socket for Async<std::os::unix::net |
| 73 |
} |
| 74 |
|
| 75 |
fn poll_write_ready(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>> { |
| 76 |
- self.poll_writable(cx) |
| 77 |
+ self.poll_writable(cx) |
| 78 |
} |
| 79 |
|
| 80 |
fn poll_shutdown(&mut self, _cx: &mut Context<'_>) -> Poll<io::Result<()>> { |
| 81 |
+ unsafe { |
| 82 |
Poll::Ready(self.get_mut().shutdown(Shutdown::Both)) |
| 83 |
+ } |
| 84 |
} |
| 85 |
} |