error[E0554]: #[feature] may not be used on the stable release channel


#1

I try to compile the test.rs from this repo

But I get this error message

error[E0554]: #[feature] may not be used on the stable release channel
  --> test.rs:15:1
   |
15 | #![feature(rand)]
   | ^^^^^^^^^^^^^^^^^

error: aborting due to previous error

My compiler version is rustc 1.14.0 (e8a012324 2016-12-16)

Is it possible to compile this code somehow? Or do I need a nightly build from rustc?


#2

The rand crate has what you want. Replace the feature gate attribute with extern crate rand,
add a rand = "0.3.15" dependency to your Cargo.toml and you’re good to go.