Closed
Description
ISSUE MOVED TO rust-lang/rust#53548
(edit: simpler reproducer without channels at #1199 (comment))
On the currently-latest commit of futures-rs
(c02ec75), with the currently-latest nightly (2018-08-14), the following code does not build:
#![feature(async_await, await_macro, futures_api)]
extern crate futures;
use futures::{channel::mpsc::{self, SendError}, prelude::*};
use std::any::Any;
async fn send(msg: Box<Any + Send + 'static>) -> Result<(), SendError> {
let (mut sender, _) = mpsc::channel(1);
await!(sender.send(msg))
}
It fails with the following error:
error[E0279]: the requirement `for<'r> 'r : 'static` is not satisfied (`expected bound lifetime parameter, found concrete lifetime`)
--> erlust/src/lib.rs:8:72
|
8 | async fn send(msg: Box<Any + Send + 'static>) -> Result<(), SendError> {
| ________________________________________________________________________^
9 | | let (mut sender, _) = mpsc::channel(1);
10 | | await!(sender.send(msg))
11 | | }
| |_^
|
= note: required so that the lifetime bound of `` for `dyn std::any::Any + std::marker::Send` is satisfied
error: aborting due to previous error
I can't figure out the reason why it fails, so I'm assuming it's something in futures-rs
. But maybe it's actually a rustc bug from async/await? Or maybe it's just me missing something obvious, actually :)
Metadata
Metadata
Assignees
Labels
No labels