Skip to content

Commit e3a9b1d

Browse files
committed
Check whether a static is mutable instead of passing it down
1 parent a6202e2 commit e3a9b1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> {
6363
global_value
6464
}
6565

66-
fn codegen_static(&self, def_id: DefId, is_mutable: bool) {
66+
fn codegen_static(&self, def_id: DefId) {
6767
let attrs = self.tcx.codegen_fn_attrs(def_id);
6868

6969
let value = match codegen_static_initializer(&self, def_id) {
@@ -92,7 +92,7 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> {
9292

9393
// As an optimization, all shared statics which do not have interior
9494
// mutability are placed into read-only memory.
95-
if !is_mutable && self.type_is_freeze(ty) {
95+
if !self.tcx.static_mutability(def_id).unwrap().is_mut() && self.type_is_freeze(ty) {
9696
#[cfg(feature = "master")]
9797
global.global_set_readonly();
9898
}

0 commit comments

Comments
 (0)