-
Notifications
You must be signed in to change notification settings - Fork 123
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
backtrace method was removed by Rust #195
Comments
If it's hard to get the provider API working, e.g. because it's not ready yet. Then I think we can temporarily remove backtrace functionality from derive_more until we can create a good implementation. |
@JelteF btw, would you consider to release |
Maybe I'm missing something, but a quick look at thiserror suggests that shouldn't be a breaking change. Th |
@JelteF makes sense. Even changes like |
@JelteF @tyranron I'm not really sure, how to make transition to enum MyError {
First(FirstError),
Second { source: SecondError, backtrace: Backtrace }
}
impl Error for MyError {
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
match self {
First(first) => {
// What should we do here?
// 1. Just try to call provide on `first`?
first.provide(demand);
// 2. Attach it as a concrete type?
demand.provide_ref::<FirstError>(first);
// 3. Attach it as `dyn Error`?
demand.provide_ref::<dyn Error>(first);
// Or all 3 of them?
}
Second { source, backtrace } => {
// All questions above are still valid for `source`.
// But with `backtrace`, it's clear to me, that we should
// attach it.
demand.provide_ref::<Backtrace>(backtrace);
}
}
}
} I propose to wait until there is more understanding of
|
@ilslv ☝️ |
@tyranron It looks like enum MyError {
First(#[error(backtrace)] FirstError),
Second { #[error(source)] source: SecondError, #[error(backtrace)] backtrace: Backtrace }
}
impl Error for MyError {
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
match self {
First(first) => {
first.provide(demand);
}
Second { source, backtrace } => {
source.provide(demand);
demand.provide_ref::<Backtrace>(backtrace);
}
}
}
} I think it looks reasonable and we should mirror the implementation. |
@ilslv 👍 |
@tyranron @ilslv The tests started failing with the most recent rust nightlies because of this: rust-lang/rust#99431
Could you spend some time to fix it and use the Provider API instead? rust-lang/rust#96024
I wanted to release version 1.0.0 of derive_more but this blocks me from doing that.
The text was updated successfully, but these errors were encountered: