rust/tests/compile-fail/oom2.rs
Scott Olson 6503148589 Optimize reads of field projections of ByValPairs.
This helps in the case of field projections of the results of checked
binary operations. E.g.:

    _1 = CheckedAdd(const 1i32, const 2i32);
    assert(!(_1.1: bool), "attempt to add with overflow" -> bb1

Previously, the `_1.1` field projection lvalue would force_allocate `_1`
so it could read the memory in the old-style way. Now checked math with
its assertions will not allocate at all.

The oom2.rs compile-fail test had to be re-written, because the old
version of it no longer allocates _at all_ (yay!), so it would hit the
stack depth limit instead, from recursion.
2016-10-16 19:58:22 -06:00

9 lines
193 B
Rust

#![feature(box_syntax, custom_attribute, attr_literals)]
#![miri(memory_size=1000)]
fn main() {
loop {
::std::mem::forget(box 42); //~ ERROR tried to allocate 4 more bytes
}
}