Skip to content

Commit b0b8de7

Browse files
authored
Merge pull request #155 from RalfJung/stacked-borrows
clarify detail for Stacked Borrows
2 parents 97cbda4 + 22c8643 commit b0b8de7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

wip/stacked-borrows.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,11 @@ fn grant(
239239
```
240240
We proceed as follows:
241241

242-
1. Find the granting item for the parent tag. If there is none, this is UB.
243-
2. Check if we are adding a `SharedReadWrite`.
242+
1. We consider this operation as corresponding to a write access if `new.perm.grants(AccessKind::Write)`, and to a read access otherwise.
243+
2. Find the granting item for this access and the parent tag. If there is none, this is UB.
244+
3. Check if we are adding a `SharedReadWrite`.
244245
- If yes, add the new item on top of the current block.
245-
- If no, perform the actions of an access (this is a write access if `new.perm.grants(AccessKind::Write)`, i.e. if the new item grants write permission, and a read access otherwise).
246+
- If no, perform the actions of the corresponding access.
246247
Then push the new item to the top of the stack.
247248

248249
**Reborrowing a pointer.**

0 commit comments

Comments
 (0)