about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-26 01:00:15 +0200
committerGitHub <noreply@github.com>2020-04-26 01:00:15 +0200
commitb964451a72eb20283ee8f23541eae24474278158 (patch)
tree2da08db096a823c52e089e473aa46751645a8732 /src/rustllvm/RustWrapper.cpp
parente51cbc8376857f40ed053f54fc1fbe90f6817cdd (diff)
parente4ab4ee020479d9312560e29056313ee9836c6d2 (diff)
downloadrust-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