From 3310419d35c51b4da14c2fee9c0dcfab6b66ea0d Mon Sep 17 00:00:00 2001 From: Zalathar Date: Fri, 18 Oct 2024 21:43:37 +1100 Subject: Make `llvm::set_section` take a `&CStr` --- compiler/rustc_codegen_llvm/src/llvm/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'compiler/rustc_codegen_llvm/src/llvm') 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()); } } -- cgit 1.4.1-3-g733a5