A runtime logic error produces an incorrect computation even when Rust compiles and the program runs. The compiler cannot determine whether the implementation matches the intended operation. section 6.1
Reduce the risk of logic errors by making computation easier to test:
- Break computation into small functions. section 6.1
- Prefer stateless and deterministic functions. section 6.1
- Use unit tests to validate intended results, and return Result or Option for expected failure and absence cases. section 6.1
Wrong operator, valid program
The compiler may accept a function that uses division where the intended computation requires multiplication. Both operations are valid Rust; only testing or review can expose the incorrect result. section 6.1


