#![feature(plugin)] #![plugin(rocket_codegen)] #![allow(dead_code)] #![deny(unmanaged_state)] extern crate rocket; use rocket::State; struct MyType; struct MySecondType; mod external { #[get("/state/extern")] fn unmanaged(_c: ::State) { } //~^ ERROR not currently being managed #[get("/state/extern")] fn managed(_c: ::State) { } //~^ WARN is not mounted #[get("/state/extern")] fn unmanaged_unmounted(_c: ::State) { } //~^ WARN is not mounted } #[get("/state/bad")] fn unmanaged(_b: State) { } //~^ ERROR not currently being managed #[get("/state/ok")] fn managed(_a: State) { } #[get("/state/bad")] fn managed_two(_b: State) { } #[get("/state/ok")] fn unmounted_doesnt_error(_a: State) { } //~^ WARN is not mounted #[get("/ignored")] #[allow(unmanaged_state)] fn ignored(_b: State) { } #[get("/unmounted/ignored")] #[allow(unmounted_route)] fn unmounted_ignored() { } fn main() { rocket::ignite() .mount("/", routes![managed, unmanaged, external::unmanaged]) .mount("/", routes![managed_two, ignored]) .manage(MyType) .manage(100u32); }