From 87c8ec9c389abf4d139cb6e5a70a6638a4a8456e Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Tue, 9 Mar 2021 00:10:14 +0000 Subject: [PATCH] panic example for integer overflow --- examples/panic.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/panic.rs b/examples/panic.rs index a454edb2..b7256aee 100644 --- a/examples/panic.rs +++ b/examples/panic.rs @@ -18,5 +18,9 @@ fn main(_argc: isize, _argv: *const *const u8) -> isize { if input.is_just_pressed(gba::input::Button::A) { bitmap.draw_point(display::WIDTH, 0, 0x05); } + if input.is_just_pressed(gba::input::Button::B) { + #[allow(arithmetic_overflow)] + let p = core::i32::MAX + 1; + } } }