Skip to content

clarify detail for Stacked Borrows #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions wip/stacked-borrows.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ fn grant(
```
We proceed as follows:

1. Find the granting item for the parent tag. If there is none, this is UB.
2. Check if we are adding a `SharedReadWrite`.
1. We consider this operation as corresponding to a write access if `new.perm.grants(AccessKind::Write)`, and to a read access otherwise.
2. Find the granting item for this access and the parent tag. If there is none, this is UB.
3. Check if we are adding a `SharedReadWrite`.
- If yes, add the new item on top of the current block.
- 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).
- If no, perform the actions of the corresponding access.
Then push the new item to the top of the stack.

**Reborrowing a pointer.**
Expand Down