Treat RETURN_PLACE as a normal Local

Copy its value to the `return_place` upon leaving a call frame
This commit is contained in:
Jonas Schievink 2020-04-15 23:29:29 +02:00
parent 8ce3f840ae
commit 4eaf535d2b
7 changed files with 41 additions and 69 deletions

View file

@ -13,7 +13,7 @@ LL | / const OUT_OF_BOUNDS_PTR: NonNull<u8> = { unsafe {
LL | | let ptr: &[u8; 256] = mem::transmute(&0u8); // &0 gets promoted so it does not dangle
LL | | // Use address-of-element for pointer arithmetic. This could wrap around to NULL!
LL | | let out_of_bounds_ptr = &ptr[255];
| | ^^^^^^^^^ Memory access failed: pointer must be in-bounds at offset 256, but is outside bounds of alloc8 which has size 1
| | ^^^^^^^^^ Memory access failed: pointer must be in-bounds at offset 256, but is outside bounds of alloc11 which has size 1
LL | | mem::transmute(out_of_bounds_ptr)
LL | | } };
| |____-

View file

@ -11,7 +11,7 @@ LL | / const MUTATING_BEHIND_RAW: () = {
LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
LL | | unsafe {
LL | | *MUTABLE_BEHIND_RAW = 99
| | ^^^^^^^^^^^^^^^^^^^^^^^^ writing to alloc1 which is read-only
| | ^^^^^^^^^^^^^^^^^^^^^^^^ writing to alloc2 which is read-only
LL | | }
LL | | };
| |__-