Skip to content

Commit 975908d

Browse files
committed
auto merge of #12185 : nikomatsakis/rust/issue-12033-tweak-test, r=alexchrichton
2 parents db264b4 + d63df5f commit 975908d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/run-pass/temporary-lifetime-for-conditions.rs renamed to src/test/run-pass/cleanup-rvalue-during-if-and-while.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111

12-
// This test verifies that temporaries created for `while`'s
13-
// and `if` conditions are correctly cleaned up.
12+
// This test verifies that temporaries created for `while`'s and `if`
13+
// conditions are dropped after the condition is evaluated.
1414

1515
struct Temporary;
1616

@@ -37,6 +37,7 @@ pub fn main() {
3737
// `drop` 6 times.
3838
while borrow().do_stuff() {
3939
i += 1;
40+
unsafe { assert_eq!(DROPPED, i) }
4041
if i > 5 {
4142
break;
4243
}
@@ -45,6 +46,6 @@ pub fn main() {
4546
// This if condition should
4647
// call it 1 time
4748
if borrow().do_stuff() {
48-
unsafe { assert_eq!(DROPPED, 7) }
49+
unsafe { assert_eq!(DROPPED, i + 1) }
4950
}
5051
}

0 commit comments

Comments
 (0)