steffengy / tiberius

TDS 7.4 (mssql / Microsoft SQL Server) async driver for rust. Fork at: https://github.com/prisma/tiberius
Apache License 2.0
151 stars 2 forks source link

and_then method cannot be invoked on a trait object with rustc 1.40 #112

Closed jburnett closed 4 years ago

jburnett commented 4 years ago

Follow repro steps for issue #111; using the following in Cargo.toml [dependencies] tiberius = { version = "0.3.*", default-features=false,features=["chrono"] } futures = "0.3.*" futures-state-stream = "0.2.*" tokio = "0.1.*"

Build using cargo build

Result: error: theand_thenmethod cannot be invoked on a trait object --> src/main.rs:24:9 | 24 | .and_then(|conn| { | ^^^^^^^^ |

The associated suggestion did not fix the error. help: another candidate was found in the following trait, perhaps add ausefor it: | 5 | use crate::tokio::prelude::Future; |

steffengy commented 4 years ago

You should use futures-state-stream="0.1". Futures 0.3 might work with a compatibility layer, but try first with 0.1.

jburnett commented 4 years ago

Thanks! That fixed it. In case you're interested, a warning still occurs: warning: use of deprecated item 'tokio::executor::current_thread': use tokio-current-thread crate or functions in tokio::runtime::current_thread instead --> src/main.rs:7:5 | 7 | use tokio::executor::current_thread; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note:#[warn(deprecated)]on by default