Here is a very simple program that panics and displays a message:
use futures::{future::FutureExt, select};
#[tokio::main]
async fn main() {
select! {
_ = panic_message().fuse() => {},
}
}
async fn panic_message() {
tokio::spawn(async {
panic!("This message is not displayed!");
});
}
It runs as expected in playground, but when it is run on my machine, cargo run
simply exits without any panic message displayed in the terminal.
Only minimum dependencies are included in Cargo.toml
:
futures = "0.3.2"
tokio = { version = "0.2.11", features = ["macros", "rt-core"] }
Not sure if it matters but my machine is an Arch Linux running Rust 1.41.
Can anyone please explain why the panic message can be missing? Thanks!