Skip to content

Commit 3e6925c

Browse files
authored
Merge pull request #344 from RalfJung/unpin
Revert "also document the !Unpin exception"
2 parents 9872d9e + e5ad3b4 commit 3e6925c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

wip/stacked-borrows.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Changes from to the latest post (2.1) to the paper:
2222

2323
Changes since publication of the paper:
2424

25-
* HACK: Mutable references to `!Unpin` types do not make uniqueness assumptions.
2625
* Items with `SharedReadWrite` permission are not protected even with `FnEntry` retagging.
2726

2827
[Miri]: https://github.com./solson/miri/
@@ -289,9 +288,8 @@ fn reborrow(
289288
We will grant `new_tag` permission for all the locations covered by this place, by calling `grant` for each location.
290289
The parent tag (`derived_from`) is given by the place.
291290
The interesting question is which permission to use for the new item:
292-
- For non-two-phase `Unique` to an `Unpin` type, the permission is `Unique`.
293-
(The `Unpin` exception is a special hack to avoid soundness issues due to self-referential generators.)
294-
- For mutable raw pointers and the remaining `Unique`, the permission is `SharedReadWrite`.
291+
- For non-two-phase `Unique`, the permission is `Unique`.
292+
- For mutable raw pointers and two-phase `Unique`, the permission is `SharedReadWrite`.
295293
- For `Shared` and immutable raw pointers, the permission is different for locations inside of and outside of `UnsafeCell`.
296294
Inside `UnsafeCell`, it is `SharedReadWrite`; outside it is `SharedReadOnly`.
297295
- The `UnsafeCell` detection is entirely static: it recurses through structs,
@@ -308,10 +306,10 @@ Otherwise the new item will not have a protector.
308306
So, basically, for every location, we call `grant` like this:
309307
```rust
310308
let (perm, protect) = match ref_kind {
311-
RefKind::Unique { two_phase: false } if unpin =>
309+
RefKind::Unique { two_phase: false } =>
312310
(Permission::Unique, protect),
313311
RefKind::Raw { mutable: true } |
314-
RefKind::Unique { .. } =>
312+
RefKind::Unique { two_phase: true } =>
315313
(Permission::SharedReadWrite, protect),
316314
RefKind::Raw { mutable: false } |
317315
RefKind::Shared =>

0 commit comments

Comments
 (0)