about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-10-18 00:00:23 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-10-18 17:46:33 -0700
commit888efe74a3b1f54fcb34e5c8c4f17dd2a381989f (patch)
tree1c90c6544378c7c865b10e23808893e1c0cd1ae1 /compiler/rustc_codegen_llvm/src/llvm
parentdd5127615ad626741a1116d022cf784637ac05df (diff)
cg_llvm: Switch `llvm::add_global` to `&CStr`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/mod.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
index d0db350a149..e790c6696fa 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
@@ -217,8 +217,7 @@ pub fn set_section(llglobal: &Value, section_name: &str) {
     }
 }
 
-pub fn add_global<'a>(llmod: &'a Module, ty: &'a Type, name: &str) -> &'a Value {
-    let name_cstr = CString::new(name).expect("unexpected CString error");
+pub fn add_global<'a>(llmod: &'a Module, ty: &'a Type, name_cstr: &CStr) -> &'a Value {
     unsafe { LLVMAddGlobal(llmod, ty, name_cstr.as_ptr()) }
 }