Here's how to customize a build:
- Create a new binary project using cargo new custom-build and open the project folder using VS Code.
- Open src/main.rs and replace the hello world code with the following:
fn main() { println!("Overflow! {}", 128u8 + 129u8);}
- The code in our binary is now creating an overflow situation that a compiler can easily catch. However, the default release build has that feature turned off. Run cargo run --release to see it in action:
$ cargo run --release Finished release [optimized] target(s) in 0.02s Running `target/release/custom-build`Overflow! 1
- If we wanted to change the fact that the compiler verifies overflow errors at compile time in release mode (even though overflows can be useful, for ...