-
Notifications
You must be signed in to change notification settings - Fork 1
Use upstream traits - Backtrace, ChainedError, ErrorChainIter, ResultExt, State #5
Comments
In fact, would you be OK to merge our two repos? |
I don't think this will work. If I implemented it here it would be a completely new ChainedError trait for each errorkind struct (similar to how ChainIter / make_backtrace are emitted once for each errorkind), so it won't interop with
Sure, but how would it work given that the codegen is completely separate? macro_rules vs proc_macro_derive function? |
There is only one |
Yes, but since there is no |
I think we can do like with |
That makes sense. I can change this one's output to use the |
And |
In Serde we use the following hack to work around this. We expand: #[derive(Serialize)]
struct Point {
/* ... */
} ... into: const _IMPL_SERIALIZE_FOR_Point: () = {
extern crate serde as _serde;
impl _serde::Serialize for Point {
/* ... */
}
}; This way it works whether or not the user's code has |
Hum, didn't know this trick, thanks! |
Adding @brson to the conversation. |
@dtolnay the user still have to put |
Yes they do. |
BTW, macros 1.1 should be in |
Well... I wouldn't go that far just yet. There are a few inconveniences compared to
|
@Yamakaky I'm done with the port to use error_chain traits, with one snag. Because the latest release 0.6.1 doesn't have this commit the codegen of derive-error-chain can't use |
Can you use |
Okay, I'll keep it in a separate branch then. |
Thank you. I already have a breaking syntax change on master, and I'm trying to fix the last one I'm aware of. Please ping me if I haven't made a new release in a week or two ;) |
I recently added the
ChainedError
trait to error-chain. It would be cool if you could implement in with your crate, so that the two could be used together. Here is how it is implemented in the macro: https://github.com/brson/error-chain/blob/master/src/error_chain.rs#L71-L84.I'll add your crate in my README ;)
The text was updated successfully, but these errors were encountered: