As mentioned in the output, we can set the environment variable RUST_BACKTRACE to 1 in order to get more information about where the test failed. Let's do so:
export RUST_BACKTRACE=1
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Running target/debug/deps/ftp_server-452667ddc2d724e8 running 2 tests test codec::tests::test_encoder ... ok test codec::tests::test_dummy ... FAILED failures: ---- codec::tests::test_dummy stdout ---- thread 'codec::tests::test_dummy' panicked at 'Always fail', src/codec.rs:102:8 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. stack backtrace: 0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: std::sys_common::backtrace::_print at /checkout/src/libstd/sys_common/backtrace.rs:68 2: std::panicking::default_hook::{{closure}} at /checkout/src/libstd/sys_common/backtrace.rs:57 at /checkout/src/libstd/panicking.rs:381 3: std::panicking::default_hook at /checkout/src/libstd/panicking.rs:391 4: std::panicking::rust_panic_with_hook at /checkout/src/libstd/panicking.rs:577 5: std::panicking::begin_panic at /checkout/src/libstd/panicking.rs:538 6: ftp_server::codec::tests::test_dummy at src/codec.rs:102 7: <F as test::FnBox<T>>::call_box at /checkout/src/libtest/lib.rs:1491 at /checkout/src/libcore/ops/function.rs:223 at /checkout/src/libtest/lib.rs:142 8: __rust_maybe_catch_panic at /checkout/src/libpanic_unwind/lib.rs:99 failures: codec::tests::test_dummy
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out error: test failed, to rerun pass '--bin ftp-server'
The important part here is the following:
6: ftp_server::codec::tests::test_dummy at src/codec.rs:102
This shows the file, function, and line where the code panicked.
This variable is useful even outside of testing code: when debugging a problem with a code that panics, we can use this variable as well.