rushmorem / derive-error

Derive macro for Error using macros 1.1
Apache License 2.0
32 stars 4 forks source link

Rust 2018 support: `crate::` #4

Open yrashk opened 5 years ago

yrashk commented 5 years ago

Attempting to compile this (notice crate:: prefix in Error):

#[macro_use]
extern crate derive_error;

#[derive(Error)]
pub enum Err {
    A
}

#[derive(Error)]
pub enum Error {
    SomeErr(crate::Err),
}

results in the following failure:

 help: message: failed to parse the error defination: "failed to parse derive input: \"pub enum Error { SomeErr(crate::Err), }\""                                                                                

I tried upgrading syn/quote in derive-error but there seem to be breaking changes so I didn't follow through yet.

dtolnay commented 5 years ago

This will require updating syn to 0.15. Your current version is from before crate:: was introduced to Rust.

yrashk commented 5 years ago

This is exactly what I tried to do, but since it wasn't a straightforward upgrade, I didn't follow through yet.