Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues compiling figment with Rocket #9

Closed
yilmazgunalp opened this issue Feb 17, 2021 · 3 comments
Closed

Having issues compiling figment with Rocket #9

yilmazgunalp opened this issue Feb 17, 2021 · 3 comments

Comments

@yilmazgunalp
Copy link

Hi,

I am newish to Rust and Rocket. I am trying to use Figment with Rocket but it doesn't compile. I am getting this error:

|
= note: see issue #47809 rust-lang/rust#47809 for more information
= help: add #![feature(track_caller)] to the crate attributes to enable

error[E0658]: the #[track_caller] attribute is an experimental feature
--> /home/yg/.cargo/registry/src/github.com-1ecc6299db9ec823/figment-0.9.4/src/figment.rs:176:5
|
176 | #[track_caller]
| ^^^^^^^^^^^^^^^
|
= note: see issue #47809 rust-lang/rust#47809 for more information
= help: add #![feature(track_caller)] to the crate attributes to enable

error[E0658]: use of unstable library feature 'track_caller': uses #[track_caller] which is not yet stable
--> /home/yg/.cargo/registry/src/github.com-1ecc6299db9ec823/figment-0.9.4/src/providers/serialized.rs:80:18
|
80 | loc: Location::caller()
| ^^^^^^^^^^^^^^^^

This is from my Cargo.toml:

serde = { version = "1.0", features = ["derive"] }
figment = { version = "0.9", features = ["toml", "env"] }

This is my main function:

fn main() {
    let port = env::var("PORT").expect("$PORT must be set");

    let figment = Figment::new()
    .merge(Toml::file("Rocket.toml"))
    .merge(Env::prefixed("ROCKET_"));

    rocket::custom(figment)
    .attach(DbConn::fairing())
    .mount("/", routes![
        posts::list,
        posts::new
        ]).launch();
}

I added #[macro_use] extern crate figment; to my main.rs as well but didnt help

@SergioBenitez
Copy link
Owner

You simply need a newer rustc. rustup update.

@yilmazgunalp
Copy link
Author

Thanks! I also had to increase the Figment version to 0.10.3

@SergioBenitez
Copy link
Owner

That should be unnecessary; there is no compatibility difference between the 0.10.x releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants