To run Rust program with a backtrace one should set environment variable RUST_BACKTRACE to one and run the program, so my first guess as inexperienced bash user was:
$ RUST_BACKTRACE=1 && cargo run
...
note: Run with `RUST_BACKTRACE=1` for a backtrace.
but there are no backtrace in the output. So, let's check if variable is set:
RUST_BACKTRACE=1 && echo $RUST_BACKTRACE && cargo run
1
...
note: Run with `RUST_BACKTRACE=1` for a backtrace.
and finally working solution would be:
RUST_BACKTRACE=1 cargo run
Please explain to me how it works.