We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents db264b4 + d63df5f commit 975908dCopy full SHA for 975908d
src/test/run-pass/temporary-lifetime-for-conditions.rs renamed to src/test/run-pass/cleanup-rvalue-during-if-and-while.rs
@@ -9,8 +9,8 @@
9
// except according to those terms.
10
11
12
-// This test verifies that temporaries created for `while`'s
13
-// 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.
14
15
struct Temporary;
16
@@ -37,6 +37,7 @@ pub fn main() {
37
// `drop` 6 times.
38
while borrow().do_stuff() {
39
i += 1;
40
+ unsafe { assert_eq!(DROPPED, i) }
41
if i > 5 {
42
break;
43
}
@@ -45,6 +46,6 @@ pub fn main() {
45
46
// This if condition should
47
// call it 1 time
48
if borrow().do_stuff() {
- unsafe { assert_eq!(DROPPED, 7) }
49
+ unsafe { assert_eq!(DROPPED, i + 1) }
50
51
0 commit comments