Skip to content

Commit d066a7b

Browse files
committed
update compile-fail/pushpop-unsafe-rejects.rs to reflect switch from saturated to checked arith.
1 parent 2d68d09 commit d066a7b

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

src/test/compile-fail/pushpop-unsafe-rejects.rs

+25-24
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,30 @@ fn main() {
4545
});
4646

4747

48-
// Note: For implementation simplicity I have chosen to just have
49-
// the stack do "saturated pop", but perhaps we would prefer to
50-
// have cases like these two here be errors:
51-
52-
pop_unsafe!{ g() };
53-
54-
push_unsafe!({
55-
pop_unsafe!(pop_unsafe!{ g() })
56-
});
57-
58-
59-
// Okay, back to examples that do error, even in the presence of
60-
// "saturated pop"
61-
62-
push_unsafe!({
63-
g();
64-
pop_unsafe!(pop_unsafe!({
65-
f() //~ ERROR: call to unsafe function
66-
}))
67-
});
68-
69-
pop_unsafe!({
70-
f(); //~ ERROR: call to unsafe function
71-
})
48+
// Note: For implementation simplicity the compiler just
49+
// ICE's if you underflow the push_unsafe stack.
50+
//
51+
// Thus all of the following cases cause an ICE.
52+
//
53+
// (The "ERROR" notes are from an earlier version
54+
// that used saturated arithmetic rather than checked
55+
// arithmetic.)
56+
57+
// pop_unsafe!{ g() };
58+
//
59+
// push_unsafe!({
60+
// pop_unsafe!(pop_unsafe!{ g() })
61+
// });
62+
//
63+
// push_unsafe!({
64+
// g();
65+
// pop_unsafe!(pop_unsafe!({
66+
// f() // ERROR: call to unsafe function
67+
// }))
68+
// });
69+
//
70+
// pop_unsafe!({
71+
// f(); // ERROR: call to unsafe function
72+
// })
7273

7374
}

0 commit comments

Comments
 (0)