about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-07-09 09:36:19 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-07-14 08:27:08 +0000
commit56d22cd29ff6d3ea1fa8972462ad94792960b1ef (patch)
treed092f80caf8ffd5e343612e09b19903a62fa3978 /compiler/rustc_codegen_llvm/src/builder.rs
parentb9baf63f99bbdf69571e26fca907af032c416591 (diff)
downloadrust-56d22cd29ff6d3ea1fa8972462ad94792960b1ef.tar.gz
rust-56d22cd29ff6d3ea1fa8972462ad94792960b1ef.zip
Use context methods instead of directly calling FFI
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/builder.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
index 4c5bc8430cc..3c64cb79d5e 100644
--- a/compiler/rustc_codegen_llvm/src/builder.rs
+++ b/compiler/rustc_codegen_llvm/src/builder.rs
@@ -303,9 +303,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
         }
 
         let id_str = "branch_weights";
-        let id = unsafe {
-            llvm::LLVMMDStringInContext2(self.cx.llcx, id_str.as_ptr().cast(), id_str.len())
-        };
+        let id = self.cx.create_metadata(id_str.into());
 
         // For switch instructions with 2 targets, the `llvm.expect` intrinsic is used.
         // This function handles switch instructions with more than 2 targets and it needs to