How to use derive macros on the 2018 edition?

I’m trying to use failure in a 2018-edition crate, but I’m getting:

error: cannot find derive macro `Fail` in this scope

What do I need to import to make it work? use failure::Fail doesn’t fix it.

Edit: adding use failure::* fixes it, though it gives me an unused import warning :stuck_out_tongue:. I’d rather not use glob imports though, and instead actually know what I’m importing.

When you imported the failure crate, did you add the #[macro_use] attribute?

I’m using the 2018 edition and trying not to use extern crate declarations at all, since they’re deprecated.

Then you must use #![feature(use_extern_macros)]


Aha! That fixed it :smiley:. I forgot all about that feature.

Thanks a lot!

Link is not working

That content is now here: