diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-10 19:59:17 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-10 19:59:17 +0100 |
| commit | b90277e37b0ef43b8a3755f027ae29c991172fd0 (patch) | |
| tree | d992eb66a8fa9fa192a0e0bfd409cc37d234f784 /compiler/rustc_codegen_llvm/src/llvm_util.rs | |
| parent | 35a0961bbc8fba75bb863c7835b39d431ad9fc5d (diff) | |
| parent | 660d985d12bd66dde21490fefb31c9b7fb22a67e (diff) | |
| download | rust-b90277e37b0ef43b8a3755f027ae29c991172fd0.tar.gz rust-b90277e37b0ef43b8a3755f027ae29c991172fd0.zip | |
Rollup merge of #106921 - madsmtm:cell-memory-layout, r=dtolnay
Add documentation about the memory layout of `Cell` https://github.com/rust-lang/rust/pull/101717 guaranteed the memory layout of `UnsafeCell<T>`. This property (a guaranteed memory layout) can be useful to have on `Cell<T>` as well. (Note that `Cell<u8>` [already doesn't trigger the `improper_ctypes` lint](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=34af59ef60b96d8a8bdaec1d52cb5420) since it is `#[repr(transparent)]`). The concrete use-case is for the crate [`objc2`](https://github.com/madsmtm/objc2) to specify that `Cell<T>` is safe to use as an instance variable when `T` is. Fixes https://github.com/rust-lang/rust/issues/79303. --- I'm unsure if we should specify less, for example say that the `Cell` may have extra restrictions on when it may be accessed, or if that's implicit in the (deliberately minimal) way I've worded it here?
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions
