Rust test failures — error[E____] / thread panicked
Log signatures
error[E0308]: mismatched types thread 'tests::it_works' panicked test result: FAILED assertion `left == right` failed
What’s happening
Two very different failures share this class: error[E____] is a compile error — your tests never ran (Rust error codes are exceptionally well documented; rustc --explain E0308 gives you a worked example). thread '...' panicked + test result: FAILED is a runtime test failure — an assert!/assert_eq! miss, an explicit panic!, or an unwrap() on None/Err inside test or code under test. The thread name in the panic line is the test name — that's your rerun target.
Fix playbook
- 1Compile errors first: cargo test won't run anything until the crate compiles. Fix the first error[E____]; later errors are often cascade.
- 2Runtime failure: rerun just that test with output visible: cargo test test_name -- --nocapture --exact.
- 3unwrap() panics in code under test: the fix is usually error propagation (?) at the panicking call, not in the test.
- 4Set RUST_BACKTRACE=1 in CI's env permanently — a panic without a backtrace wastes one full round-trip per failure.
- 5Rerun the crate's tests (cargo test -p <crate>) before the workspace.
Prevention
- Deny unwrap() in production paths via clippy (#![warn(clippy::unwrap_used)]) — most "test failures" of the panic flavor are unwraps that should have been ? all along.
Triage every red build, not just this one.
This page is one of 31 failure classes the open-source patchrail CLI matches from a raw log — locally, with secrets redacted first. If a log stumps it, open an issue; if it saves you a debugging morning, a star helps other maintainers find it.
★ Star on GitHub
pipx install patchrail