@@ -22,6 +22,7 @@ Changes from to the latest post (2.1) to the paper:
22
22
23
23
Changes since publication of the paper:
24
24
25
+ * HACK: Mutable references to ` !Unpin ` types do not make uniqueness assumptions.
25
26
* Items with ` SharedReadWrite ` permission are not protected even with ` FnEntry ` retagging.
26
27
27
28
[ Miri ] : https://github.com./solson/miri/
@@ -288,8 +289,9 @@ fn reborrow(
288
289
We will grant `new_tag ` permission for all the locations covered by this place , by calling `grant ` for each location .
289
290
The parent tag (`derived_from `) is given by the place .
290
291
The interesting question is which permission to use for the new item :
291
- - For non - two - phase `Unique `, the permission is `Unique `.
292
- - For mutable raw pointers and two - phase `Unique `, the permission is `SharedReadWrite `.
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 `.
293
295
- For `Shared ` and immutable raw pointers , the permission is different for locations inside of and outside of `UnsafeCell `.
294
296
Inside `UnsafeCell `, it is `SharedReadWrite `; outside it is `SharedReadOnly `.
295
297
- The `UnsafeCell ` detection is entirely static : it recurses through structs ,
@@ -306,10 +308,10 @@ Otherwise the new item will not have a protector.
306
308
So , basically , for every location , we call `grant ` like this :
307
309
```rust
308
310
let (perm , protect ) = match ref_kind {
309
- RefKind :: Unique { two_phase : false } =>
311
+ RefKind :: Unique { two_phase : false } if unpin =>
310
312
(Permission :: Unique , protect ),
311
313
RefKind :: Raw { mutable : true } |
312
- RefKind :: Unique { two_phase : true } =>
314
+ RefKind :: Unique { .. } =>
313
315
(Permission :: SharedReadWrite , protect ),
314
316
RefKind :: Raw { mutable : false } |
315
317
RefKind :: Shared =>
0 commit comments