about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/context.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-29 07:53:56 +0000
committerbors <bors@rust-lang.org>2023-08-29 07:53:56 +0000
commitf6faef447536204549eb47f12884d3e229fe87d3 (patch)
tree7b3f2907e6a4134b4b34037485ce71844b529196 /compiler/rustc_codegen_llvm/src/context.rs
parentcedbe5c715c1fa9359683c5f108bed2054ac258b (diff)
parente7a1e4271d3c65fb707518d89890195faab29efe (diff)
downloadrust-f6faef447536204549eb47f12884d3e229fe87d3.tar.gz
rust-f6faef447536204549eb47f12884d3e229fe87d3.zip
Auto merge of #114795 - RalfJung:cell-swap, r=dtolnay
make Cell::swap panic if the Cells partially overlap

The following function ought to be sound:
```rust
fn as_cell_of_array<T, const N: usize>(c: &[Cell<T>; N]) -> &Cell<[T; N]> {
    unsafe { transmute(c) }
}
```
However, due to `Cell::swap`, it currently is not -- safe code can [cause a use-after-free](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=c9415799722d985ff7d2c2c997b724ca). This PR fixes that.

Fixes https://github.com/rust-lang/rust/issues/80778
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/context.rs')
0 files changed, 0 insertions, 0 deletions