Closed azriel91 closed 4 years ago
I think this is running into a general failure where linkme
doesn't support distributed slices declared in modules.
The implementation for linkme::distributed_slice
makes two things with the same ident - one of them is a static, and the other is a macro_rules!
macro. The static can be referred to using xxx::THING
syntax, but the macro can't, since #[macro_export]
macro_rules!
macros are always exported in the crate root, regardless of the module they're declared in.
I've opened https://github.com/dtolnay/linkme/issues/18 to track this issue. In the meantime, maybe there'd be a way to do this avoiding using an inner module - so at least traits declared in the crate root could be supported?
Attempt at doing https://github.com/dtolnay/typetag/issues/15.
Changes:
inventory
calls todistributed_slice
s.const
wrapper to amod
wrapper -- thelinkme
distributed slice macro cannot be referenced when inside the const.This doesn't work yet -- unsure why the module static is not resolved when running
cargo test --all
:cargo expand
shows that it exists:Anyone: feel free to work on this. I'm not continuing this attempt yet as I can't figure out what's wrong -- maybe it's to do with macro invocation and type resolution order, but that's beyond my current understanding.