diff options
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/consts.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/mono_item.rs | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs index 8e047f124ee..4afa230e598 100644 --- a/compiler/rustc_codegen_llvm/src/consts.rs +++ b/compiler/rustc_codegen_llvm/src/consts.rs @@ -232,7 +232,7 @@ impl<'ll> CodegenCx<'ll, '_> { trace!(?instance); let DefKind::Static { nested, .. } = self.tcx.def_kind(def_id) else { bug!() }; - // Nested statics do not have a type, so pick a random type and let `define_static` figure out + // Nested statics do not have a type, so pick a dummy type and let `codegen_static` figure out // the llvm type from the actual evaluated initializer. let llty = if nested { self.type_i8() @@ -415,8 +415,7 @@ impl<'ll> CodegenCx<'ll, '_> { llvm::LLVMRustSetDSOLocal(g, true); } - // As an optimization, all shared statics which do not have interior - // mutability are placed into read-only memory. + // Forward the allocation's mutability (picked by the const interner) to LLVM. if alloc.mutability.is_not() { llvm::LLVMSetGlobalConstant(g, llvm::True); } diff --git a/compiler/rustc_codegen_llvm/src/mono_item.rs b/compiler/rustc_codegen_llvm/src/mono_item.rs index 81ac9571885..29100a64171 100644 --- a/compiler/rustc_codegen_llvm/src/mono_item.rs +++ b/compiler/rustc_codegen_llvm/src/mono_item.rs @@ -24,7 +24,7 @@ impl<'tcx> PreDefineMethods<'tcx> for CodegenCx<'_, 'tcx> { ) { let instance = Instance::mono(self.tcx, def_id); let DefKind::Static { nested, .. } = self.tcx.def_kind(def_id) else { bug!() }; - // Nested statics do not have a type, so pick a random type and let `define_static` figure out + // Nested statics do not have a type, so pick a dummy type and let `codegen_static` figure out // the llvm type from the actual evaluated initializer. let ty = if nested { self.tcx.types.unit |
