Please enable `overflow-checks` for Rust runtime
45
Mar 17, 2022

When running the same code on my local machine with the following version of rust and cargo:

  • rustc 1.56.1 (59eed8a2a 2021-11-01)
  • cargo 1.56.0 (4ed5d137b 2021-10-04)

Rust runtime would produce a nice output and panic when an i32 or i64 overflows

thread 'main' panicked at 'attempt to add with overflow', src/main.rs:60:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However, the Rust runtime on LeetCode would not panic, and it would yield an wrong answer.

It would be nice if LeetCode can enable the overflow-checks for Rust runtime.

Comments (1)