diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-16 17:09:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-16 17:09:33 +0200 |
| commit | f432d5030ed4c16932cab88bbf71175cd285a03b (patch) | |
| tree | b7d6b5b5f7143cc302e005147eccf02a36c83769 /src/test/debuginfo/enum-thinlto.rs | |
| parent | b6269f27d99d7da9e95f0b3fdc53193dc8c42fbe (diff) | |
| parent | 5462ecb4b131a513b2d821d52b9af491781bd898 (diff) | |
| download | rust-f432d5030ed4c16932cab88bbf71175cd285a03b.tar.gz rust-f432d5030ed4c16932cab88bbf71175cd285a03b.zip | |
Rollup merge of #63955 - RalfJung:intern, r=oli-obk
Make sure interned constants are immutable
This makes sure that interning for constants (not statics) creates only immutable allocations.
Previously, the "main" allocation of `const FOO: Cell<i32> = Cell::new(0);` was marked as mutable, but I don't think we want that. It can be only copied, not written to.
Also, "leftover" allocations (behind raw pointers etc) were left mutable. I don't think we want to support that. I tried asserting that these are all already immutable (to double-check our static checks), but that failed in this one:
```rust
const NON_NULL_PTR2: NonNull<u8> = unsafe { mem::transmute(&0) };
```
Seems like maybe we want more precise mutability annotation inside Miri for locals (like `&0` here) so that this would actually become immutable to begin with?
I also factored `intern_shallow` out of the visitor so that we don't have to construct a visitor when we do not plan to visit anything. That confused me at first.
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
