Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

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

Open
dflemstr opened this issue Jan 6, 2019 · 1 comment
Open

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

dflemstr opened this issue Jan 6, 2019 · 1 comment

Comments

@dflemstr
Copy link

dflemstr commented Jan 6, 2019

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 :)

@theduke
Copy link
Contributor

theduke commented Jan 12, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants