shepmaster / snafu

Easily assign underlying errors into domain-specific errors while adding context
https://docs.rs/snafu/
Apache License 2.0
1.45k stars 61 forks source link

Non static error type chaining #253

Closed Qwaz closed 4 years ago

Qwaz commented 4 years ago

Hello, I'm currently working on a project which uses an arena allocator. This setup makes almost all values and errors have 'arena lifetime.

The problem is that every type that goes to source field should have 'static lifetime because of the requirement of the Error trait. This restriction makes it impossible to use Snafu to chain my error types via source field.

If my understanding is correct, Snafu's mechanism for attaching context to hierarchical errors does not necessarily need 'static lifetime. Is there a way to opt-out from automatic implementation of Error trait or make source() always return None, and use non static error types for error chaining?

shepmaster commented 4 years ago

duplicate of #99?

Qwaz commented 4 years ago

Seems so, I was searching with keyword "static" and missed that!