chore: update bytes dependency to git master (#1796)

Tokio will track changes to bytes until 0.5 is released.
This commit is contained in:
Carl Lerche
2019-11-20 14:27:49 -08:00
committed by GitHub
parent 3e643c7b81
commit 5cd665afd7
26 changed files with 101 additions and 331 deletions
+8 -1
View File
@@ -47,7 +47,14 @@ impl<C: Decoder + Unpin> Stream for UdpFramed<C> {
let (_n, addr) = unsafe {
// Read into the buffer without having to initialize the memory.
let res = ready!(Pin::new(&mut pin.socket).poll_recv_from(cx, pin.rd.bytes_mut()));
//
// safety: we know tokio::net::UdpSocket never reads from the memory
// during a recv
let res = {
let bytes = &mut *(pin.rd.bytes_mut() as *mut _ as *mut [u8]);
ready!(Pin::new(&mut pin.socket).poll_recv_from(cx, bytes))
};
let (n, addr) = res?;
pin.rd.advance_mut(n);
(n, addr)