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

rocket_codegen lints fail to handle unresolved HIR paths leading to failed compilation #367

Closed
Lapz opened this issue Jul 31, 2017 · 4 comments
Labels
bug Deviation from the specification or expected behavior

Comments

@Lapz
Copy link

Lapz commented Jul 31, 2017

Bug Report

  1. Rocket v 0.3.0, Rust: 1.21.0-nightly (aac223f4f 2017-07-30)

  2. macOS Sierra v 10.12.6

  3. Rocket codegen enters unreachable code that crashes the compiler

  4. I've an example in this repo

  5. Rocket codegen enters unreachable code. It seems to be that there is a case that is reached that is covered by the unreachable! macro in the rocket_codegen lint and this causes the compiler to crash.

@SergioBenitez SergioBenitez added the triage A bug report being investigated label Jul 31, 2017
@SergioBenitez
Copy link
Member

What code is being compiled?

@Lapz
Copy link
Author

Lapz commented Jul 31, 2017

This is the code thats being compiled

use rocket::config::{Config, Environment};


#[get("/hello")]
fn hello() -> &'static str {
    "Hello, world!"
}


fn main() {


    let config = Config::build(Environment::Staging)
                .address("localhost")
                .port(3000)
                .finalize()
                .unwrap();
    

    // rocket::custom(config, false).mount("/", routes![hello]); // This compiles properly 

    rocket::Rocket::custom(config,false).mount("/", routes![hello]); // This causes an error and does not compile due to the unreachable! in the lint
}

@SergioBenitez
Copy link
Member

SergioBenitez commented Jul 31, 2017

Ah, I see. Change rocket::Rocket::custom to rocket::custom. Does the error go away?

Missed your answer in the text. Looks good! Should be a very simple fix.

@SergioBenitez SergioBenitez added bug Deviation from the specification or expected behavior and removed triage A bug report being investigated labels Aug 2, 2017
@SergioBenitez
Copy link
Member

Confirmed. Fix is incoming.

@SergioBenitez SergioBenitez changed the title Rocket_codegen unable to compile rocket_codegen lints fail to handle unresolved HIR paths leading to failed compilation Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Deviation from the specification or expected behavior
Projects
None yet
Development

No branches or pull requests

2 participants