Comments (5)
I always end up hitting this whenever I have a trait with an associated Error type.
from eyre.
I'm sorry to say but it is impossible to implement std::error::Error
for eyre::Report<H>
or any similar type. You'll likewise find that std::error::Error
is not implemented for anyhow::Error
or Box<dyn Error>
. This is because you cannot implement both From<E: Error>
and Error
. All types already implement From<T> for T
which does a no-op conversion, if eyre::Report
implemented Error
the compiler wouldn't know whether or not it should wrap itself in another Report
or do nothing each time you try to convert a report into a report.
The breaking change was related to a type inference bug in the eyre!
macro, can you show me the exact code sample you have that is producing this error? If you have code that did compile that no longer compiles it probably indicates that the macro was erroneously compiling the code before but I just want to be sure.
from eyre.
Thanks for explaining. The last commit in this branch bumps eyre, leading to the error above, for example in this line: https://github.com/vitorenesduarte/fantoch/blob/eyre_bump/fantoch_exp/src/ping.rs#L60
(not sure if it helps, but in a few minutes the error should also be visible here in the "Check fantoch_exp" step)
from eyre.
aaah, this is because you upgraded before tsunami did, so it sees the two Report
s as different types which means it doesn't apply the From<T> for T
conversion and instead tries to resolve the conversion via the only other From
impl, which is From<E: Error>
.
It's probably worth waiting on this one, the breaking change that was made was exceedingly minor and I'm now kinda regretting even making it, but I'm also planning a much bigger breaking change in the near future with this PR #29. Short term I recommend just sticking with the older version, but if you need to deal with version mismatches now or in the future one work around is to first convert the Report
into a Box<dyn Error>
and then convert that back into the new report type, this sadly discards the context of the original report so I'm not even sure its worth it but it will at least preserve the full chain of errors and gather context where it is converted which might be sufficient.
https://docs.rs/eyre/0.5.0/eyre/struct.Report.html#impl-From%3CReport%3CH%3E%3E
from eyre.
Ah, I see. Thanks for pointing it out. I'll wait for that PR then. Thanks.
from eyre.
Related Issues (20)
- Extend `Option` with `ok_or_eyre`? HOT 2
- Improve discoverability of `OptionExt::ok_or_eyre` HOT 2
- Ergonomics: Hide `context` behind a feature HOT 4
- [breaking] remove alias exports `DefaultContext` and `EyreContext`
- [breaking] Remove `anyhow` from default features HOT 2
- `cargo doc` warning: "this URL is not a hyperlink"
- Segfault in `Report::downcast()` introduced in 0.6.9 HOT 6
- enable raw mode compatibility for panic & error reports HOT 1
- `fn Ok()` breaks all code with `use eyre::*` in new releases HOT 5
- `OptionExt` feature test is incorrectly feature-gated behind the `anyhow` flag
- [ BREAKING ] `ContextCompat` contains identically named methods to `WrapErr` which can be confusing and a footgun HOT 1
- [email protected] missing in the repository? HOT 2
- Eyre broken in rust-analyzer with nightly HOT 1
- and_then() that automatically converts error type to Report? HOT 11
- docs: enclosing in backticks HOT 1
- Implement From for anyhow errors
- New version of backtrace doesn't export `gimli-symbolize` anymore
- Path to 1.0
- DISCUSS: merge eyre and anyhow libraries HOT 1
- Add pre-hook callbacks HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eyre.