dtolnay / thiserror

derive(Error) for struct and enum error types

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors with Generics - missing trait bounds.

drahnr opened this issue · comments

During cleaning up some of the error handling in paritytech/substrate I encountered that using #[error("yada {0:?}")] for something along the lines of struct Erroris<T>(pub Wrapper<T>) does not enforce a T: Debug bound on the underlying generic type, but requires adding a bound on the struct declaration/definition rather than the generated fmt::Debug impl. That goes against what is stated as a best practice in the future proofing guide https://rust-lang.github.io/api-guidelines/future-proofing.html?#data-structures-do-not-duplicate-derived-trait-bounds-c-struct-bounds .

paritytech/substrate#7631 (comment)

It would be awesome if this could be addressed ❤️

Probably a duplicate of: #79

Yeah this is tracked in #79, and is just waiting on a PR.