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
Whatever is not async compatible #322
Comments
When reporting an issue, it’s useful to produce an MRE. When next I have time to investigate this issue, I’ll spend it on reproducing the problem. Then the next time i have, I can work on addressing the problem. |
Should work if you adjust the trait object to be use snafu::{prelude::*, whatever};
#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(whatever, display("{message}"))]
Whatever {
message: String,
#[snafu(source(from(Box<dyn std::error::Error + Send + Sync>, Some)))]
source: Option<Box<dyn std::error::Error + Send + Sync>>,
},
}
fn create() -> Result<(), Error> {
whatever!("Broken")
}
fn main() {
fn is_send(_: impl Send) {}
is_send(create());
} |
Yes, that works. I don't know if it should be added to the documentation or not. Thanks. |
I stumbled across this today as well. It should definitly added to the guide at Lines 167 to 185 in ba92e75
|
Feedback welcome on #331 |
Published in https://crates.io/crates/snafu/0.7.1 |
Following the instructions on the front page, I have
This results in the error:
Removing the Whatever block from my error enum fixes the message. I wasn't using whatever! in my async function but it was annoying stripping it from the rest of my code.
I'm a rust newbie, so problem is likely PBKAC, but in case it might affect others I raised an issue. I've now purged whatever usage, so I'm fine with you closing the issue if that's appropriate.
The text was updated successfully, but these errors were encountered: