rust/tests/compile-fail/oom2.rs
Scott Olson 20ced4a720 Replace const_to_ptr with const_to_value.
This reduces the number of allocations Miri makes drastically. The
`const_to_ptr` function was a lame hack that allocated for every since simple
constant, and all of those are avoided now, except for one extra allocation each
for string and bytestring literals which will be fixed in a followup commit.

There are a number of hacks such as `eval_operand_to_ptr` left over from this
commit, which will also be fixed in followup commits.
2016-09-19 02:19:34 -06:00

47 lines
1.5 KiB
Rust

#![feature(custom_attribute, attr_literals)]
#![miri(memory_size=1000)]
fn bar(i: i32) {
if i < 1000 {
bar(i + 1) //~ ERROR tried to allocate 4 more bytes, but only 1 bytes are free of the 1000 byte memory
//~^NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
//~|NOTE inside call to bar
}
}
fn main() { //~NOTE inside call to main
bar(1);
//~^NOTE inside call to bar
}