diff --git a/src/test/run-pass/temporary-lifetime-for-conditions.rs b/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs similarity index 82% rename from src/test/run-pass/temporary-lifetime-for-conditions.rs rename to src/test/run-pass/cleanup-rvalue-during-if-and-while.rs index 0716ea5cdeb..1ae907065bf 100644 --- a/src/test/run-pass/temporary-lifetime-for-conditions.rs +++ b/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs @@ -9,8 +9,8 @@ // except according to those terms. -// This test verifies that temporaries created for `while`'s -// and `if` conditions are correctly cleaned up. +// This test verifies that temporaries created for `while`'s and `if` +// conditions are dropped after the condition is evaluated. struct Temporary; @@ -37,6 +37,7 @@ pub fn main() { // `drop` 6 times. while borrow().do_stuff() { i += 1; + unsafe { assert_eq!(DROPPED, i) } if i > 5 { break; } @@ -45,6 +46,6 @@ pub fn main() { // This if condition should // call it 1 time if borrow().do_stuff() { - unsafe { assert_eq!(DROPPED, 7) } + unsafe { assert_eq!(DROPPED, i + 1) } } }