Check whether a static is mutable instead of passing it down
This commit is contained in:
parent
a6202e2a77
commit
e3a9b1dbec
@ -63,7 +63,7 @@ fn static_addr_of(&self, cv: RValue<'gcc>, align: Align, kind: Option<&str>) ->
|
||||
global_value
|
||||
}
|
||||
|
||||
fn codegen_static(&self, def_id: DefId, is_mutable: bool) {
|
||||
fn codegen_static(&self, def_id: DefId) {
|
||||
let attrs = self.tcx.codegen_fn_attrs(def_id);
|
||||
|
||||
let value = match codegen_static_initializer(&self, def_id) {
|
||||
@ -92,7 +92,7 @@ fn codegen_static(&self, def_id: DefId, is_mutable: bool) {
|
||||
|
||||
// As an optimization, all shared statics which do not have interior
|
||||
// mutability are placed into read-only memory.
|
||||
if !is_mutable && self.type_is_freeze(ty) {
|
||||
if !self.tcx.static_mutability(def_id).unwrap().is_mut() && self.type_is_freeze(ty) {
|
||||
#[cfg(feature = "master")]
|
||||
global.global_set_readonly();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user