about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/consts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/consts.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/consts.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_codegen_llvm/src/consts.rs b/compiler/rustc_codegen_llvm/src/consts.rs
index 27f6a119727..40e686b253c 100644
--- a/compiler/rustc_codegen_llvm/src/consts.rs
+++ b/compiler/rustc_codegen_llvm/src/consts.rs
@@ -477,13 +477,7 @@ impl<'ll> CodegenCx<'ll, '_> {
                 .unwrap_or(true)
         {
             if let Some(section) = attrs.link_section {
-                let section = unsafe {
-                    llvm::LLVMMDStringInContext2(
-                        self.llcx,
-                        section.as_str().as_c_char_ptr(),
-                        section.as_str().len(),
-                    )
-                };
+                let section = self.create_metadata(section.as_str().into());
                 assert!(alloc.provenance().ptrs().is_empty());
 
                 // The `inspect` method is okay here because we checked for provenance, and