about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/mod.rs
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-10-18 21:43:37 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-10-20 17:08:05 +1100
commit3310419d35c51b4da14c2fee9c0dcfab6b66ea0d (patch)
tree2c1869d1ece466cbc22ae3f9cb88bfccbc083f88 /compiler/rustc_codegen_llvm/src/llvm/mod.rs
parentd68c32779627fcd72a928c9e89f65094dbcf7482 (diff)
downloadrust-3310419d35c51b4da14c2fee9c0dcfab6b66ea0d.tar.gz
rust-3310419d35c51b4da14c2fee9c0dcfab6b66ea0d.zip
Make `llvm::set_section` take a `&CStr`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/mod.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/mod.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
index b306396e15a..e837022044e 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
@@ -210,10 +210,9 @@ impl MemoryEffects {
     }
 }
 
-pub fn set_section(llglobal: &Value, section_name: &str) {
-    let section_name_cstr = CString::new(section_name).expect("unexpected CString error");
+pub fn set_section(llglobal: &Value, section_name: &CStr) {
     unsafe {
-        LLVMSetSection(llglobal, section_name_cstr.as_ptr());
+        LLVMSetSection(llglobal, section_name.as_ptr());
     }
 }