rust-lang-nursery / lazy-static.rs

A small macro for defining lazy evaluated static variables in Rust.
Apache License 2.0
1.9k stars 111 forks source link

Unable to build #147

Closed giann closed 5 years ago

giann commented 5 years ago

Can lazy-static be built with cargo stable? I'm getting the following errors:

error: const fns are an unstable feature
  --> src/inline_lazy.rs:20:33
   |
20 |     pub const INIT: Self = Lazy(Cell::new(None), ONCE_INIT);
   |                                 ^^^^^^^^^^^^^^^
   |
   = help: in Nightly builds, add `#![feature(const_fn)]` to the crate attributes to enable

error[E0493]: constants are not allowed to have destructors
  --> src/inline_lazy.rs:20:33
   |
20 |     pub const INIT: Self = Lazy(Cell::new(None), ONCE_INIT);
   |                                 ^^^^^^^^^^^^^^^ constants cannot have destructors

error[E0493]: constants are not allowed to have destructors
  --> src/inline_lazy.rs:20:28
   |
20 |     pub const INIT: Self = Lazy(Cell::new(None), ONCE_INIT);
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constants cannot have destructors

I'm completely new to Rust so forgive me if I missed something obvious.

giann commented 5 years ago

Nevermind I had an old version of Rust