jpernst / rental

Rust macro to generate self-referential structs
Apache License 2.0
211 stars 11 forks source link

When `rental!` used via full path, implementation details leak #33

Closed nagisa closed 5 years ago

nagisa commented 5 years ago
error: cannot find derive macro `__rental_structs_and_impls` in this scope
   --> src/blah/mod.rs:82:1
    |
82  | / rental::rental! {
83  | |     mod rentals {
84  | |         use foo;
85  | |         use bar;
...   |
116 | |     }
117 | | }
    | |_^
    |
    = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

I think if the derives inside the rental! macro were using $crate::__rental_structs_and_impls or whatever, things would be working?

jpernst commented 5 years ago

The first thing to try is to explicitly include the rental crate with the macro_use attribute. Rental doesn't support rust 2018's implicit crate inclusion.

Stargateur commented 4 years ago

would be nice to include this information in the readme