2020-06-16 12:01:26 +00:00
|
|
|
#![allow(dead_code, unused_variables)]
|
|
|
|
|
|
|
|
mod a {
|
|
|
|
// async launch that is async.
|
|
|
|
#[rocket::launch]
|
|
|
|
async fn rocket() -> rocket::Rocket {
|
2021-04-08 08:07:52 +00:00
|
|
|
let _ = rocket::build().launch().await;
|
|
|
|
rocket::build()
|
2020-06-16 12:01:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async fn use_it() {
|
|
|
|
let rocket: rocket::Rocket = rocket().await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod b {
|
|
|
|
// async launch that isn't async.
|
|
|
|
#[rocket::launch]
|
|
|
|
async fn main2() -> rocket::Rocket {
|
2021-04-08 08:07:52 +00:00
|
|
|
rocket::build()
|
2020-06-16 12:01:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
async fn use_it() {
|
|
|
|
let rocket: rocket::Rocket = main2().await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-13 05:32:02 +00:00
|
|
|
mod b_inferred {
|
|
|
|
#[rocket::launch]
|
2021-04-08 08:07:52 +00:00
|
|
|
async fn main2() -> _ { rocket::build() }
|
2020-10-13 05:32:02 +00:00
|
|
|
|
|
|
|
async fn use_it() {
|
|
|
|
let rocket: rocket::Rocket = main2().await;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-16 12:01:26 +00:00
|
|
|
mod c {
|
|
|
|
// non-async launch.
|
|
|
|
#[rocket::launch]
|
|
|
|
fn rocket() -> rocket::Rocket {
|
2021-04-08 08:07:52 +00:00
|
|
|
rocket::build()
|
2020-06-16 12:01:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn use_it() {
|
|
|
|
let rocket: rocket::Rocket = rocket();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-13 05:32:02 +00:00
|
|
|
mod c_inferred {
|
|
|
|
#[rocket::launch]
|
2021-04-08 08:07:52 +00:00
|
|
|
fn rocket() -> _ { rocket::build() }
|
2020-10-13 05:32:02 +00:00
|
|
|
|
|
|
|
fn use_it() {
|
|
|
|
let rocket: rocket::Rocket = rocket();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-16 12:01:26 +00:00
|
|
|
mod d {
|
|
|
|
// main with async, is async.
|
|
|
|
#[rocket::main]
|
|
|
|
async fn main() {
|
2021-04-08 08:07:52 +00:00
|
|
|
let _ = rocket::build().launch().await;
|
2020-06-16 12:01:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod e {
|
|
|
|
// main with async, isn't async.
|
|
|
|
#[rocket::main]
|
|
|
|
async fn main() { }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod f {
|
|
|
|
// main with async, is async, with termination return.
|
|
|
|
#[rocket::main]
|
|
|
|
async fn main() -> Result<(), String> {
|
2021-04-08 08:07:52 +00:00
|
|
|
let result = rocket::build().launch().await;
|
2020-06-16 12:01:26 +00:00
|
|
|
result.map_err(|e| e.to_string())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod g {
|
|
|
|
// main with async, isn't async, with termination return.
|
|
|
|
#[rocket::main]
|
|
|
|
async fn main() -> Result<(), String> {
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// main with async, is async, with termination return.
|
|
|
|
#[rocket::main]
|
|
|
|
async fn main() -> Result<(), String> {
|
2021-04-08 08:07:52 +00:00
|
|
|
let result = rocket::build().launch().await;
|
2020-06-16 12:01:26 +00:00
|
|
|
result.map_err(|e| e.to_string())
|
|
|
|
}
|