about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/profiling.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-16 16:14:47 +0000
committerbors <bors@rust-lang.org>2024-07-16 16:14:47 +0000
commit16b569057e4d1591b4bee05f10df34000308dedc (patch)
tree91e0788419dd4b30c1b21dfce0c11503c0d88ac4 /compiler/rustc_codegen_llvm/src/back/profiling.rs
parenta91f7d72f12efcc00ecf71591f066c534d45ddf7 (diff)
parentab4cc440dd4711fbdba04417aa43910d95576c13 (diff)
downloadrust-16b569057e4d1591b4bee05f10df34000308dedc.tar.gz
rust-16b569057e4d1591b4bee05f10df34000308dedc.zip
Auto merge of #127819 - matthiaskrgr:rollup-djdffkl, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #127669 (Fix the issue of invalid suggestion for a reference of iterator)
 - #127707 (match lowering: Use an iterator to find `expand_until`)
 - #127730 (Fix and enforce `unsafe_op_in_unsafe_fn` in compiler)
 - #127789 (delete #![allow(unsafe_op_in_unsafe_fn)] in teeos)
 - #127805 (run-make-support: update gimli to 0.31.0)
 - #127808 (Make ErrorGuaranteed discoverable outside types, consts, and lifetimes)
 - #127817 (Fix a bunch of sites that were walking instead of visiting, making it impossible for visitor impls to look at these values)
 - #127818 (Various ast validation simplifications)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/profiling.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/profiling.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/profiling.rs b/compiler/rustc_codegen_llvm/src/back/profiling.rs
index 2741f7d848e..2eee9f8c5a3 100644
--- a/compiler/rustc_codegen_llvm/src/back/profiling.rs
+++ b/compiler/rustc_codegen_llvm/src/back/profiling.rs
@@ -46,13 +46,15 @@ pub unsafe extern "C" fn selfprofile_before_pass_callback(
     pass_name: *const c_char,
     ir_name: *const c_char,
 ) {
-    let llvm_self_profiler = &mut *(llvm_self_profiler as *mut LlvmSelfProfiler<'_>);
-    let pass_name = CStr::from_ptr(pass_name).to_str().expect("valid UTF-8");
-    let ir_name = CStr::from_ptr(ir_name).to_str().expect("valid UTF-8");
-    llvm_self_profiler.before_pass_callback(pass_name, ir_name);
+    unsafe {
+        let llvm_self_profiler = &mut *(llvm_self_profiler as *mut LlvmSelfProfiler<'_>);
+        let pass_name = CStr::from_ptr(pass_name).to_str().expect("valid UTF-8");
+        let ir_name = CStr::from_ptr(ir_name).to_str().expect("valid UTF-8");
+        llvm_self_profiler.before_pass_callback(pass_name, ir_name);
+    }
 }
 
 pub unsafe extern "C" fn selfprofile_after_pass_callback(llvm_self_profiler: *mut c_void) {
-    let llvm_self_profiler = &mut *(llvm_self_profiler as *mut LlvmSelfProfiler<'_>);
+    let llvm_self_profiler = unsafe { &mut *(llvm_self_profiler as *mut LlvmSelfProfiler<'_>) };
     llvm_self_profiler.after_pass_callback();
 }