From f47bb2d3374f1628f2a94efdf19af9b63c770ee2 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 15 Oct 2018 18:18:21 +0200 Subject: [PATCH 1/1] clarify what happens when memory gets deallocated --- ralf/_posts/2018-08-07-stacked-borrows.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ralf/_posts/2018-08-07-stacked-borrows.md b/ralf/_posts/2018-08-07-stacked-borrows.md index 3577e3d..8050139 100644 --- a/ralf/_posts/2018-08-07-stacked-borrows.md +++ b/ralf/_posts/2018-08-07-stacked-borrows.md @@ -450,6 +450,7 @@ Now we can look at what happens for each operation. * Any time a function returns, we have to clean up the barriers. - Iterate over all of memory and remove the matching `FnBarrier`. This is where the "stack" becomes a bit of a lie, because we also remove barriers from the middle of a stack.
This could be optimized by adding an indirection, so we just have to record somewhere that this function call has ended. +* Any time memory is deallocated, the stacks of the deallocated bytes must not contain any barriers. Moreover, deallocation counts as mutation, so the usual rules for that apply. If you want to test your own understanding of "Stacked Borrows", I invite you to go back to [Section 2.2 of "Types as Contracts"]({% post_url 2017-07-17-types-as-contracts %}#22-examples) and look at the three examples here. -- 2.30.2