Skip to content

fix(version) Fix compilation error with tokio master #1895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ log = "0.4"
net2 = { version = "0.2.32", optional = true }
pin-utils = "0.1.0-alpha.4"
time = "0.1"
tokio = { git = "https://github.com/tokio-rs/tokio", optional = true, default-features = false, features = ["rt-full"] }
tokio-buf = "0.1"
tokio-executor = { git = "https://github.com/tokio-rs/tokio" }
tokio-io = { git = "https://github.com/tokio-rs/tokio" }
tokio-reactor = { git = "https://github.com/tokio-rs/tokio", optional = true }
tokio-sync = { git = "https://github.com/tokio-rs/tokio" }
tokio-tcp = { git = "https://github.com/tokio-rs/tokio", optional = true, features = ["async-traits"] }
tokio-threadpool = { git = "https://github.com/tokio-rs/tokio", optional = true }
tokio-timer = { git = "https://github.com/tokio-rs/tokio", optional = true }
tokio = { version = "0.2.0-alpha.1", optional = true, default-features = false, features = ["rt-full"] }
tokio-buf = { version = "0.2.0-alpha.1" }
tokio-executor = { version = "0.2.0-alpha.1" }
tokio-io = { version = "0.2.0-alpha.1" }
tokio-reactor = { version = "0.2.0-alpha.1", optional = true }
tokio-sync = { version = "0.2.0-alpha.1" }
tokio-tcp = { version = "0.2.0-alpha.1", optional = true, features = ["async-traits"] }
tokio-threadpool = { version = "0.2.0-alpha.1", optional = true }
tokio-timer = { version = "0.3.0-alpha.1", optional = true }
want = { git = "https://github.com/seanmonstar/want", branch = "std-future" }

[dev-dependencies]
Expand All @@ -55,8 +55,8 @@ spmc = "0.2"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
tokio-fs = { git = "https://github.com/tokio-rs/tokio" }
tokio-test = { git = "https://github.com/tokio-rs/tokio" }
tokio-fs = { version = "0.2.0-alpha.1" }
tokio-test = { version = "0.2.0-alpha.1" }
url = "1.0"


Expand Down
4 changes: 2 additions & 2 deletions examples/send_file.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#![feature(async_await)]
#![deny(warnings)]

use tokio::io::AsyncReadExt;
use tokio_fs::file::File;
use tokio_fs::File;

use hyper::{Body, Method, Result, Request, Response, Server, StatusCode};
use hyper::service::{make_service_fn, service_fn};
use tokio::io::AsyncReadExt;

static INDEX: &str = "examples/send_file_index.html";
static INTERNAL_SERVER_ERROR: &[u8] = b"Internal Server Error";
Expand Down
2 changes: 1 addition & 1 deletion src/client/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ where
type Output = crate::Result<()>;

fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
match ready!(Pin::new(self.inner.as_mut().unwrap()).poll(cx))? {
match ready!(Box::pin(self.inner.as_mut().unwrap()).poll_unpin(cx))? {
proto::Dispatched::Shutdown => {
Poll::Ready(Ok(()))
},
Expand Down
5 changes: 4 additions & 1 deletion src/common/drain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::mem;
use tokio_sync::{mpsc, watch};

use super::{Future, Never, Poll, Pin, task};
use futures_util::FutureExt;

// Sentinel value signaling that the watch is still open
enum Action {
Expand Down Expand Up @@ -99,7 +100,9 @@ where
loop {
match mem::replace(&mut me.state, State::Draining) {
State::Watch(on_drain) => {
match me.watch.rx.poll_ref(cx) {
let mut future = me.watch.rx.recv_ref();
let mut pin = unsafe { Pin::new_unchecked(&mut future) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1890 does this without unsafe.

match Future::poll(pin, cx) {
Poll::Ready(None) => {
// Drain has been triggered!
on_drain(unsafe { Pin::new_unchecked(&mut me.future) });
Expand Down
1 change: 0 additions & 1 deletion src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::io;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use iovec::IoVec;
use tokio_io::{AsyncRead, AsyncWrite};

use crate::common::{Pin, Poll, Unpin, task};
use super::{Http1Transaction, ParseContext, ParsedMessage};

Expand Down
7 changes: 6 additions & 1 deletion src/server/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ use std::net::{SocketAddr, TcpListener as StdTcpListener};
use std::time::{Duration, Instant};

use futures_core::Stream;
use futures_util::FutureExt as _;
use tokio_reactor::Handle;
use tokio_tcp::TcpListener;
use tokio_timer::Delay;

use crate::common::{Future, Pin, Poll, task};

pub use self::addr_stream::AddrStream;
use futures_util::FutureExt;

/// A stream of connections from binding to an address.
#[must_use = "streams do nothing unless polled"]
Expand Down Expand Up @@ -106,7 +108,10 @@ impl AddrIncoming {
self.timeout = None;

loop {
match Pin::new(&mut self.listener).poll_accept(cx) {
let mut future = self.listener.accept();
let mut pin = unsafe { Pin::new_unchecked(&mut future) };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1890 does this without unsafe.


match Future::poll(pin, cx) {
Poll::Ready(Ok((socket, addr))) => {
if let Some(dur) = self.tcp_keepalive_timeout {
if let Err(e) = socket.set_keepalive(Some(dur)) {
Expand Down