Deallocate primval conversion hack allocs.
It's a hack, sure, but it should learn some manners.
This commit is contained in:
parent
55f2164bcd
commit
b1094f6c1e
2 changed files with 13 additions and 2 deletions
|
@ -1124,7 +1124,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
|
||||||
Value::ByVal(primval) => {
|
Value::ByVal(primval) => {
|
||||||
let ptr = self.alloc_ptr(ty)?;
|
let ptr = self.alloc_ptr(ty)?;
|
||||||
self.memory.write_primval(ptr, primval)?;
|
self.memory.write_primval(ptr, primval)?;
|
||||||
self.value_to_primval(Value::ByRef(ptr), ty)
|
let primval = self.value_to_primval(Value::ByRef(ptr), ty)?;
|
||||||
|
self.memory.deallocate(ptr)?;
|
||||||
|
Ok(primval)
|
||||||
}
|
}
|
||||||
|
|
||||||
Value::ByValPair(..) => bug!("value_to_primval can't work with fat pointers"),
|
Value::ByValPair(..) => bug!("value_to_primval can't work with fat pointers"),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#![miri(memory_size=1000)]
|
#![miri(memory_size=1000)]
|
||||||
|
|
||||||
fn bar(i: i32) {
|
fn bar(i: i32) {
|
||||||
if i < 1000 { //~ERROR tried to allocate 4 more bytes, but only 1 bytes are free of the 1000 byte memory
|
if i < 1000 { //~ERROR tried to allocate 4 more bytes, but only 0 bytes are free of the 1000 byte memory
|
||||||
bar(i + 1)
|
bar(i + 1)
|
||||||
//~^NOTE inside call to bar
|
//~^NOTE inside call to bar
|
||||||
//~|NOTE inside call to bar
|
//~|NOTE inside call to bar
|
||||||
|
@ -31,6 +31,15 @@ fn bar(i: i32) {
|
||||||
//~|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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue