Log macro not found in library

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.

The project is here: https://github.com/portier/portier-broker

Any hints/tips?

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?

Here's the change I was trying to make:

https://github.com/portier/portier-broker/commit/fc59f908d1080e528ec079de3591986c289b68ab

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.

This is what I get:

djc@enrai portier-broker $ cargo build
   Compiling portier_broker v0.1.0 (file:///home/djc/src/portier-broker)
/home/djc/src/portier-broker/target/debug/build/portier_broker-9dc149cfdf14abe7/out/lib.rs:1415:9: 1415:13 error: macro undefined: 'info!'
/home/djc/src/portier-broker/target/debug/build/portier_broker-9dc149cfdf14abe7/out/lib.rs:1415         info!("{} {}" , req . method , req . url (  ));
                                                                                                        ^~~~
error: aborting due to previous error
error: Could not compile `portier_broker`.

To learn more, run the command again with --verbose.

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?

After doing that and upgrading to rust-1.11.0, it seems to work. Thanks!

FYI, I reverted to serde*-0.8.0, and it still worked. I guess the compiler upgrade fixed this bug...

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.