Cannot use lazy_static in Rust

I tried to use lazy_static. I wrote

#[macro_use]
extern crate lazy_static;

And got this error message:

error[E0464]: multiple matching crates for lazy_static

Can you fix it?

Edit: Apparently all it takes is to add lazy_static to [dependencies].

See the discussion at Adding time and rand crates for Rust. I agree that lazy_static should be made available.

1 Like

Sorry to bump an old thread, but is there any reason lazy_static still hasn’t been added as a dependency?
It certainly provides essential functionality (especially for bot programming) that exists trivially in most other languages.

1 Like

Or once-cell. Pretty much the same thing but without the need for a macro since we have const fn now, and it’s being considered for inclusion in std.

1 Like