Giter Club home page Giter Club logo

Comments (5)

blueforesticarus avatar blueforesticarus commented on July 28, 2024 2

I always end up hitting this whenever I have a trait with an associated Error type.

from eyre.

yaahc avatar yaahc commented on July 28, 2024

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.

vitorenesduarte avatar vitorenesduarte commented on July 28, 2024

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.

yaahc avatar yaahc commented on July 28, 2024

aaah, this is because you upgraded before tsunami did, so it sees the two Reports 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.

vitorenesduarte avatar vitorenesduarte commented on July 28, 2024

Ah, I see. Thanks for pointing it out. I'll wait for that PR then. Thanks.

from eyre.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.