Skip to content

Commit

Permalink
update compile-fail/pushpop-unsafe-rejects.rs to reflect switch from …
Browse files Browse the repository at this point in the history
…saturated to checked arith.
  • Loading branch information
pnkfelix committed Jul 23, 2015
1 parent 2d68d09 commit d066a7b
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions src/test/compile-fail/pushpop-unsafe-rejects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,30 @@ fn main() {
});


// Note: For implementation simplicity I have chosen to just have
// the stack do "saturated pop", but perhaps we would prefer to
// have cases like these two here be errors:

pop_unsafe!{ g() };

push_unsafe!({
pop_unsafe!(pop_unsafe!{ g() })
});


// Okay, back to examples that do error, even in the presence of
// "saturated pop"

push_unsafe!({
g();
pop_unsafe!(pop_unsafe!({
f() //~ ERROR: call to unsafe function
}))
});

pop_unsafe!({
f(); //~ ERROR: call to unsafe function
})
// Note: For implementation simplicity the compiler just
// ICE's if you underflow the push_unsafe stack.
//
// Thus all of the following cases cause an ICE.
//
// (The "ERROR" notes are from an earlier version
// that used saturated arithmetic rather than checked
// arithmetic.)

// pop_unsafe!{ g() };
//
// push_unsafe!({
// pop_unsafe!(pop_unsafe!{ g() })
// });
//
// push_unsafe!({
// g();
// pop_unsafe!(pop_unsafe!({
// f() // ERROR: call to unsafe function
// }))
// });
//
// pop_unsafe!({
// f(); // ERROR: call to unsafe function
// })

}

0 comments on commit d066a7b

Please sign in to comment.