user266003
user266003

Reputation:

use of unstable library feature - how can I fix those?

I got a bunch of errors again:

$ cargo build
error: use of unstable library feature 'std_misc'
use std::time::duration::Duration;
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: use of unstable library feature 'convert': waiting on RFC revision
let my_let1 = aaa(bbb.as_str(), ccc, ddd.eee);
                                                        ^~~~~~~~
error: use of unstable library feature 'convert': waiting on RFC revision
let let1 = aaa.as_slice();
                                             ^~~~~~~~~~
error: use of unstable library feature 'convert': waiting on RFC revision
let let1 = str::from_utf8(aaa.as_slice()).unwrap();
                                                ^~~~~~~~~~

How to solve them? What does it mean: add #![feature(collections)] to the crate attributes to enable - what crates? I don't have the source code of my crates. How would other people compile my library on their machines then?

And oddly enough this also throws an error:

src/lib.rs:1:1: 1:31 error: unstable feature
src/lib.rs:1 #![feature(convert, std_misc)]

when I add it at the top my library.

Upvotes: 7

Views: 19055

Answers (1)

Paolo Falabella
Paolo Falabella

Reputation: 25844

I'm assuming you're using Rust stable. In that case unstable features can't be enabled.

For Duration you can use the time crate on crates.io by adding it to the dependencies in your Cargo.toml.

In the other cases, you should be able to simply use &aaa and &bbb respectively to get slices out of Vec or String. e.g.

let b = String::from("foo"); // b is a String
let c: &str = &b; // c expects a &str; b is automatically dereferenced

Upvotes: 4

Related Questions