Commit 2a68c00
Rollup merge of rust-lang#56012 - RalfJung:unsafe-cell, r=nikomatsakis
avoid shared ref in UnsafeCell::get
Avoid taking a shared reference in `UnsafeCell::get`. This *should* be taking a raw reference (see rust-lang/rfcs#2582), but that operation is not currently available, so I propose we exploit `repr(transparent)` instead and cast the pointer around.
This is required to make `UnsafeCell::get` pass the [stacked borrows implementation](https://www.ralfj.de/blog/2018/11/16/stacked-borrows-implementation.html) in miri (currently, `UnsafeCell::get` is on a whitelist, but that is of course not very satisfying). It shouldn't affect normal execution/codegen. Would be great if we could get this landed and shrink miri's whitelist!
Cc @nikomatsakis1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1509 | 1509 | | |
1510 | 1510 | | |
1511 | 1511 | | |
1512 | | - | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
1513 | 1515 | | |
1514 | 1516 | | |
1515 | 1517 | | |
| |||
0 commit comments