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

Improving procmacro error reporting #274

Closed
wants to merge 2 commits into from
Closed

Improving procmacro error reporting #274

wants to merge 2 commits into from

Conversation

idubrov
Copy link

@idubrov idubrov commented Nov 15, 2018

Improving error reporting of procmacro by using compile_error! macro and quote_spanned!.

Let me know what you think.

I haven't done it 100% of the way (changing is_cause would require a bit more of the refactoring).

For example, for the following code:

#[derive(Debug, Fail)]
enum Error {
    #[fail(display = "Hello")]
    Hello,
    Bye,
}

you will get:

error: All variants must have display attribute.
  --> failure_derive/tests/no_derive_display.rs:27:5
   |
27 |     Bye,
   |     ^^^

@davidbarsky davidbarsky self-assigned this Dec 28, 2018
@davidbarsky
Copy link
Contributor

@idubrov This is a solid PR, thanks! I'm just working on fixing the merge conflict, but I'll merge right after that.

@davidbarsky
Copy link
Contributor

davidbarsky commented Dec 28, 2018

Ah, to support this, we're using a more recent version of Backtrace that doesn't work on Rust 1.18. I'll try to see if Backtrace 0.3.11 or 0.3.12 would build successfully on Rust 1.18, because #281.

@mitsuhiko mitsuhiko mentioned this pull request Dec 29, 2018
@mitsuhiko
Copy link
Contributor

Squash merged in 15b6798

@mitsuhiko mitsuhiko closed this Dec 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants