We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
anyhow::Error::chain
dyn Error + Send + Sync
anyhow::Error only supports wrapping Send + Sync errors, but the API for chainreturns non-send and non-sync errors.
anyhow::Error
Send + Sync
chain
I suspect this is to mimic the source stdlib API, if so, would it be advisable to introduce a chain_send_sync method?
chain_send_sync
The text was updated successfully, but these errors were encountered:
The same goes for the root_cause API, which with the lack of Send + Sync makes an anyhow conversion non-bijective
root_cause
Sorry, something went wrong.
What would be the expected behavior if the causes or root cause are not Send + Sync?
// [dependencies] // anyhow = "1" // threadbound = "0.1" use std::fmt::{self, Display}; use threadbound::ThreadBound; #[derive(Debug)] struct OuterError { inner: ThreadBound<InnerError>, } impl std::error::Error for OuterError { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { let inner = self.inner.get_ref()?; Some(inner) } } impl Display for OuterError { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("...") } } #[derive(Copy, Clone, Debug)] struct InnerError { p: *const (), // not sync } impl std::error::Error for InnerError {} impl Display for InnerError { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_str("...") } } fn main() { let err = f().unwrap_err(); for e in err.chain() { println!("{}", e); } } fn f() -> anyhow::Result<()> { g()?; Ok(()) } fn g() -> Result<(), OuterError> { Err(OuterError { inner: ThreadBound::new(InnerError { p: 0 as _ }), }) }
No branches or pull requests
anyhow::Error
only supports wrappingSend + Sync
errors, but the API forchain
returns non-send and non-sync errors.I suspect this is to mimic the source stdlib API, if so, would it be advisable to introduce a
chain_send_sync
method?The text was updated successfully, but these errors were encountered: