When is `extern crate` still required?

Is use of chrono an example where extern crate statement is still required? I'm getting message that it is but was wondering why. The documentation mentions something about sysroot modules as still requiring them. What are those modules and is chrono one of those?

Also there is this, but I figured since you have to get chrono from crates it's not one of those. Could a diffinitive list be created and if so how?

Additional crates that ship with rustc , such as proc_macro , alloc , and test , are not automatically included with the --extern flag when using Cargo. They must be brought into scope with an extern crate declaration, even in the 2018 edition.

No (playground link).

1 Like

Thanks. But in my compile I get:

   Compiling plus_time_value v0.0.1 (plus_time_value)
error[E0432]: unresolved import `chrono`
 --> src/time_value.rs:8:5
8 | use chrono::TimeZone;
  |     ^^^^^^ maybe a missing `extern crate chrono;`?

Perhaps you’re missing a

edition = “2018”

In your Cargo.toml?


I am. Thank you so much.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.