rust-lang-deprecated / failure

Error management

Home Page:https://rust-lang-nursery.github.io/failure/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Having a field of type Backtrace causes #[derive(Fail)] to fail

dflemstr opened this issue · comments

Test case to reproduce:

#[derive(Debug)]
struct Backtrace;

#[derive(Debug, Fail)]
#[fail(display = "error")]
struct Error {
    backtrace: Backtrace,
}

I suppose this is a common case of unhygienic procedural macros :)

The derive assumes a backtrace field to hold a failure::Backtrace.
The only sees tokens, so it can't check that the type of the field is something other than that.

I reckon there could be something like a #[fail(ignore)] attribute to enable this.