I'm trying to implement logging in a project I'm working on, but the compiler is complaining about undefined macro 'info!' even though I have #[macro_use] external crate log in the file. Now, this is a project that has both lib.rs and main.rs; the macro use in main.rs is working fine (with env_logger as the implementation). But when I try to log from lib.rs, the compiler tells me it cannot find the macro.
Another complication is that this project uses serde_codegen, and I'm actually trying to add the logging in the lib.rs.in file.
cargo build worked for me on commit 8e96999a1c5e3bd8b852f5bb667fac9aea68d199 with both nightly and stable. Is there a specific branch or commit I should be looking at or a feature I need to enable to reproduce the failure?
It is not failing on the info! macro, it is failing on req.url().
error: no method named `url` found for type `&mut iron::Request<'_, '_>` in the current scope
--> /media/david/coding/github/portier-broker/target/debug/build/portier_broker-82afc25ac1ecb3cb/out/lib.rs:1301:45
|>
1301 |> info!("{} {}" , req . method , req . url ( ));
|> ^^^^
<log macros>:7:46: 7:77: note: in this expansion of format_args!
<log macros>:9:1: 9:62: note: in this expansion of log! (defined in <log macros>)
<log macros>:4:1: 4:54: note: in this expansion of log! (defined in <log macros>)
/media/david/coding/github/portier-broker/target/debug/build/portier_broker-82afc25ac1ecb3cb/out/lib.rs:1301:9: 1301:56: note: in this expansion of info! (defined in <log macros>)
src/lib.rs:8:1: 8:47: note: in this expansion of include!
Once I fix that, cargo build succeeds. If that is not the error you are seeing then please share what you get.
What version of Rust (rustc --version)? I tried rustc 1.11.0 (9b21dcd6a 2016-08-15) and rustc 1.13.0-nightly (499484f56 2016-08-18) and both work for me.
Does it go away with cargo clean && cargo update && cargo build?
Glad it works now. I can reproduce the failure on Rust 1.10.0 but won't debug further if you are fine using 1.11.0. Thanks for the confirmation that this was a compiler issue and not a Serde issue.