Handle release mode compiler seeing through us

pull/1/head
Bradlee Speice 2018-12-06 23:11:48 -05:00
parent b565c29cfc
commit b23f7c45f7
1 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,11 @@ fn into_box() -> Box<usize> {
#[test]
#[should_panic]
fn early_return_boxing() {
into_box();
if cfg!(debug_assertions) {
// The release-mode compiler is able to optimize through the Box
into_box();
} else {
panic!("Intentional")
}
}