File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
src/librustc_mir/interpret Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -347,16 +347,10 @@ pub fn intern_const_alloc_recursive<M: CompileTimeMachine<'mir, 'tcx>>(
347347 // references and a `leftover_allocations` set (where we only have a todo-list here).
348348 // So we hand-roll the interning logic here again.
349349 match intern_kind {
350- // Mutable statics may contain mutable allocations even behind relocations
351- InternKind :: Static ( hir:: Mutability :: Mut ) => { }
352- // Once we get heap allocations we need to revisit whether immutable statics can
353- // refer to mutable (e.g. via interior mutability) allocations.
354- // Note: this is never the base value of the static, we can only get here for
355- // pointers encountered inside the base allocation, and then only for ones not at
356- // reference type, as that is checked by the type based main interner.
357- InternKind :: Static ( hir:: Mutability :: Not ) => {
358- alloc. mutability = Mutability :: Not ;
359- }
350+ // Statics may contain mutable allocations even behind relocations.
351+ // Even for immutable statics it would be ok to have mutable allocations behind
352+ // raw pointers, e.g. for `static FOO: *const AtomicUsize = &AtomicUsize::new(42)`.
353+ InternKind :: Static ( _) => { }
360354 // Raw pointers in promoteds may only point to immutable things so we mark
361355 // everything as immutable.
362356 // It is UB to mutate through a raw pointer obtained via an immutable reference.
You can’t perform that action at this time.
0 commit comments