Closed
Description
If using format_err! macro inside try_stream!:
use failure::*;
pub fn stream() -> impl Stream<Item = failure::Fallible<i32>> + Send {
async_stream::try_stream! {
Err(format_err!("adasdasd"))?;
for i in (1..10) {
yield 123;
}
}
}
It doesn't compile - *mut (dyn std::ops::Fn() + 'static)
cannot be shared between threads safely.
But when using it without format_err!:
use failure::*;
#[derive(Debug, Fail)]
#[fail(display = "my error")]
pub struct MyError;
pub fn stream() -> impl Stream<Item = Fallible<i32>> + Send {
async_stream::try_stream! {
Err(MyError)?;
for i in (1..10) {
yield 123;
}
}
}
Compiler says all Ok.
Metadata
Metadata
Assignees
Labels
No labels