How do I allow deprecated features?

4.7k views Asked by At

I have a Rust project that depends on string_cache, which requires nightly. However, the latest version of nightly is refusing to compile due to deprecated features:

$ cargo build
   Compiling string_cache v0.1.0 (https://github.com/servo/string-cache#45f19068)
/home/wilfred/.multirust/toolchains/nightly/cargo/git/checkouts/string-cache-efa5c30b1d5a962c/master/src/atom/mod.rs:65:21: 65:37 error: use of deprecated item: use `String::from` instead, #[deny(deprecated)] on by default
/home/wilfred/.multirust/toolchains/nightly/cargo/git/checkouts/string-cache-efa5c30b1d5a962c/master/src/atom/mod.rs:65             string: String::from_str(string_to_add),
                                                                                                                                            ^~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `string_cache`.

To learn more, run the command again with --verbose.

How do I compile string_cache? I've tried adding

#![allow(deprecated)]

to my main.rs, but that doesn't change the behaviour.

1

There are 1 answers

3
Shepmaster On

The compiler doesn't impose any restrictions on the usage of deprecated methods by default:

fn main() {
   (32.0f64).is_positive();
}

Compiles, but has the warning:

warning: use of deprecated item: renamed to is_sign_positive, #[warn(deprecated)] on by default

Your error message helps point to the culprit:

#[deny(deprecated)] on by default

You'll have to figure out where the deny is specified.