error-chain icon indicating copy to clipboard operation
error-chain copied to clipboard

Implementing foreign links on generic errors

Open ayoshi opened this issue 8 years ago • 5 comments
trafficstars

Hi.

Is there any way to accomplish this? For something like std::sync::PoisonError<T> for example.

ayoshi avatar Apr 24 '17 03:04 ayoshi

No, there is no polymorphism. You can foreign link PoinsonError<Thing> though for example.

Yamakaky avatar Apr 24 '17 04:04 Yamakaky

Thank you, yes, that much I succeed to do. The problem arises when there is a generic error, especially with lifetime parameters.

I think it could be implemented with addiitional parametric macro implementation - but I worked around it, so I wouldn't be able to give it a try. On Mon, 24 Apr 2017 at 7:09 Yamakaky [email protected] wrote:

No, there is no polymorphism. You can foreign link PoinsonError<Thing> though for example.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brson/error-chain/issues/146#issuecomment-296520596, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeZwBlSOUp5WyOV5Ybz5gdxC5QPmmH9ks5rzCB0gaJpZM4NFqWi .

ayoshi avatar Apr 24 '17 07:04 ayoshi

Is there a plan to implement this? It has come up a few times for me.

jsgf avatar May 17 '17 17:05 jsgf

Yeah, I know... If you have an idea of implementation, it's more than welcome ^^

Yamakaky avatar May 18 '17 17:05 Yamakaky

There is parse_generics_shim, which is macro from closed RFC, that allows parsing generics and where clause in macro, it's limited, but possible solution.

Object905 avatar Jun 05 '17 00:06 Object905