about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-11 18:39:23 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-12 08:51:20 +0000
commite2773733f35f71dba92588d6b29e43d2cc035a34 (patch)
tree17c754ada35f89929260286ebda9eaad96a5867c
parentbbedde835e1b9bb3ec9255c2b49e5cac2398ece0 (diff)
downloadrust-e2773733f35f71dba92588d6b29e43d2cc035a34.tar.gz
rust-e2773733f35f71dba92588d6b29e43d2cc035a34.zip
Some comment nits
-rw-r--r--compiler/rustc_codegen_gcc/src/mono_item.rs2
-rw-r--r--compiler/rustc_codegen_llvm/src/consts.rs5
-rw-r--r--compiler/rustc_codegen_llvm/src/mono_item.rs2
-rw-r--r--compiler/rustc_hir/src/def.rs2
4 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_gcc/src/mono_item.rs b/compiler/rustc_codegen_gcc/src/mono_item.rs
index ceaf87d1648..359d3c70b4c 100644
--- a/compiler/rustc_codegen_gcc/src/mono_item.rs
+++ b/compiler/rustc_codegen_gcc/src/mono_item.rs
@@ -26,7 +26,7 @@ impl<'gcc, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
         let attrs = self.tcx.codegen_fn_attrs(def_id);
         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 gcc type from the actual evaluated initializer.
         let ty = if nested {
             self.tcx.types.unit
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
diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs
index f6a616109c9..1810193c16b 100644
--- a/compiler/rustc_hir/src/def.rs
+++ b/compiler/rustc_hir/src/def.rs
@@ -251,7 +251,7 @@ impl DefKind {
             | DefKind::TyParam
             | DefKind::ExternCrate => DefPathData::TypeNs(name),
             // It's not exactly an anon const, but wrt DefPathData, there
-            // is not difference.
+            // is no difference.
             DefKind::Static { nested: true, .. } => DefPathData::AnonConst,
             DefKind::Fn
             | DefKind::Const