diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-06 15:00:44 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2024-03-12 05:53:46 +0000 |
| commit | 0ef52380a58d7224fac71cc36e9e4c0dc99aec33 (patch) | |
| tree | 685b7aa563c7a58e1c645f5dadd15ce30f174b3e /compiler/rustc_codegen_gcc/src | |
| parent | f0fa06bb7a0fae8743e0b5b25ccd24e03ec2ef74 (diff) | |
| download | rust-0ef52380a58d7224fac71cc36e9e4c0dc99aec33.tar.gz rust-0ef52380a58d7224fac71cc36e9e4c0dc99aec33.zip | |
Check whether a static is mutable instead of passing it down
Diffstat (limited to 'compiler/rustc_codegen_gcc/src')
| -rw-r--r-- | compiler/rustc_codegen_gcc/src/consts.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_gcc/src/consts.rs b/compiler/rustc_codegen_gcc/src/consts.rs index 327c9bdada9..740956f6fdf 100644 --- a/compiler/rustc_codegen_gcc/src/consts.rs +++ b/compiler/rustc_codegen_gcc/src/consts.rs @@ -63,7 +63,7 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> { 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 @@ impl<'gcc, 'tcx> StaticMethods for CodegenCx<'gcc, 'tcx> { // 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(); } |
