shepmaster / snafu

Easily assign underlying errors into domain-specific errors while adding context
https://docs.rs/snafu/
Apache License 2.0
1.45k stars 61 forks source link

Macro expansion referencing the core crate is not hygienic #235

Closed cswinter closed 4 years ago

cswinter commented 4 years ago

If you declare a module with the name core in a file that uses Snafu derive macro, compilation fails with a bunch of errors like the following:

error[E0433]: failed to resolve: could not find `convert` in `core`
  --> src/lib.rs:40:17
   |
40 | #[derive(Debug, Snafu)]
   |                 ^^^^^ could not find `convert` in `core`
   |
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
shepmaster commented 4 years ago

This should be an easy fix; I believe that the macro needs to output ::core instead of core. We might as well update it to ::snafu as well.

shepmaster commented 4 years ago

Fixed in 0.6.8