mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
6503148589
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.
9 lines
193 B
Rust
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
|
|
}
|
|
}
|