derive-error icon indicating copy to clipboard operation
derive-error copied to clipboard

Rust 2018 support: `crate::`

Open yrashk opened this issue 6 years ago • 2 comments

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.

yrashk avatar Nov 05 '18 01:11 yrashk

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

dtolnay avatar Nov 05 '18 01:11 dtolnay

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

yrashk avatar Nov 05 '18 01:11 yrashk