Make rust use the '' version of 'log'

For my Rust project I want to use the log logging library (together with env_logger of course).

In my Cargo.toml, I have


and then in my main Rust file, I refer to the crate with

extern crate log;

But somehow, my compiler thinks, I'm using the compiler's log crate and complains:

src/ 11:18 warning: use of unstable library feature 'rustc_private': use the `log` library instead
src/ extern crate log;

src/ 11:18 help: add #![feature(rustc_private)] to the crate attributes to silence this warning
src/ extern crate log;

How do I get cargo/rust to use the version of log (it gets built when I run cargo build)?
It may be that my rust installation is borked up (been using for months). If so, how would I fix this? (I already tried --uninstall, didn't help :frowning: )

That's a little odd... could you post your project? For me, the following setup (built with cargo build works:



name = "test-logger"
version = "0.0.1"
authors = ["..."]

log = "*"
env_logger = "*"


extern crate log;
extern crate env_logger;

fn main() {
    info!("Hello, world!");

Is yours different?

Very odd indeed. Your example works perfectly on my installation whereas my project gives me warnings or fails to build.

I have created a minimal example Gist.

I have found a way to compile my program. Apparently, the order of extern crate statements matters?!
When I move extern crate log above extern crate docopt_macros, it compiles. If log comes after docopt_macros, it fails.

Is that intentional? Feels a bit fragile to me.


// works, if you move the `extern crate log` here 
extern crate docopt_macros;

extern crate log;
extern crate env_logger;

That seems like a bug (probably related to compiler plugins). Report it.