diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-26 01:00:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-26 01:00:15 +0200 |
| commit | b964451a72eb20283ee8f23541eae24474278158 (patch) | |
| tree | 2da08db096a823c52e089e473aa46751645a8732 /src/rustllvm/RustWrapper.cpp | |
| parent | e51cbc8376857f40ed053f54fc1fbe90f6817cdd (diff) | |
| parent | e4ab4ee020479d9312560e29056313ee9836c6d2 (diff) | |
| download | rust-b964451a72eb20283ee8f23541eae24474278158.tar.gz rust-b964451a72eb20283ee8f23541eae24474278158.zip | |
Rollup merge of #71140 - oli-obk:static_cycle, r=RalfJung
[breaking change] Disallow statics initializing themselves
fixes #71078
Self-initialization is unsound because it breaks privacy assumptions that unsafe code can make. In
```rust
pub mod foo {
#[derive(Debug, Copy, Clone)]
pub struct Foo {
x: (),
}
}
pub static FOO: foo::Foo = FOO;
```
unsafe could could expect that ony functions inside the `foo` module were able to create a value of type `Foo`.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
