diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-01-11 15:01:58 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-01-15 10:48:22 +0100 |
| commit | a81784a09a084e63add1e4618dd82e8a7035c4f5 (patch) | |
| tree | 482f1bd13eeef53e3c277ef54532cd22cc582a8e /src | |
| parent | b2c43dc1adcf1d264b981a506b1840ba42eeea7f (diff) | |
Undo a change not neceesary for this bugfix
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/interpret/intern.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/librustc_mir/interpret/intern.rs b/src/librustc_mir/interpret/intern.rs index 6fd15cc79a2..68ac945ca89 100644 --- a/src/librustc_mir/interpret/intern.rs +++ b/src/librustc_mir/interpret/intern.rs @@ -347,16 +347,10 @@ pub fn intern_const_alloc_recursive<M: CompileTimeMachine<'mir, 'tcx>>( // references and a `leftover_allocations` set (where we only have a todo-list here). // So we hand-roll the interning logic here again. match intern_kind { - // Mutable statics may contain mutable allocations even behind relocations - InternKind::Static(hir::Mutability::Mut) => {} - // Once we get heap allocations we need to revisit whether immutable statics can - // refer to mutable (e.g. via interior mutability) allocations. - // Note: this is never the base value of the static, we can only get here for - // pointers encountered inside the base allocation, and then only for ones not at - // reference type, as that is checked by the type based main interner. - InternKind::Static(hir::Mutability::Not) => { - alloc.mutability = Mutability::Not; - } + // Statics may contain mutable allocations even behind relocations. + // Even for immutable statics it would be ok to have mutable allocations behind + // raw pointers, e.g. for `static FOO: *const AtomicUsize = &AtomicUsize::new(42)`. + InternKind::Static(_) => {} // Raw pointers in promoteds may only point to immutable things so we mark // everything as immutable. // It is UB to mutate through a raw pointer obtained via an immutable reference. |
