Getting error when using in sub modules
Biacode opened this issue · 4 comments
Hi,
The directory tree is:
project root
--context
----mod.rs
lib.rs
main.rs
The provided example are works well in case when it's placed in to lib.rs in the root directory.
But when I place it in to sub modules for example mod.rs in context module Ive getting error:
https://gist.github.com/Biacode/99b3b36758702cc16a3dda42d574e09a
Any ideas?
Thanks
Can you please provide complete example crate causing error? I'm not really sure what exactly should be moved to submodule: struct definition, function, tests or all of them.
@kriomant I think the best way to show this scenario is a real code.
Link below
error_scenario.tar.gz
If you try to compile provided code, you'll notice compiler warnings:
warning: unused attribute, #[warn(unused_attributes)] on by default
--> src/context/context.rs:1:1
|
1 | #![plugin(mockers_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module, #[warn(unused_attributes)] on by default
--> src/context/context.rs:1:1
|
1 | #![plugin(mockers_macros)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
What is says is that this attribute has no effect because it must be located in root module, not in submodule. This is Rust requirement and it is not specific to mockers
library. So in fact you have not imported macro from mockers
library.
Move declaration to root module. You can find fixed crate here.