about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.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/llvm_util.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/llvm_util.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index 0e89e66be49..98dc8ac86d2 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -49,12 +49,16 @@ unsafe fn configure_llvm(sess: &Session) {
     let mut llvm_c_strs = Vec::with_capacity(n_args + 1);
     let mut llvm_args = Vec::with_capacity(n_args + 1);
 
-    llvm::LLVMRustInstallErrorHandlers();
+    unsafe {
+        llvm::LLVMRustInstallErrorHandlers();
+    }
     // On Windows, an LLVM assertion will open an Abort/Retry/Ignore dialog
     // box for the purpose of launching a debugger. However, on CI this will
     // cause it to hang until it times out, which can take several hours.
     if std::env::var_os("CI").is_some() {
-        llvm::LLVMRustDisableSystemDialogsOnCrash();
+        unsafe {
+            llvm::LLVMRustDisableSystemDialogsOnCrash();
+        }
     }
 
     fn llvm_arg_to_arg_name(full_arg: &str) -> &str {
@@ -124,12 +128,12 @@ unsafe fn configure_llvm(sess: &Session) {
     }
 
     if sess.opts.unstable_opts.llvm_time_trace {
-        llvm::LLVMRustTimeTraceProfilerInitialize();
+        unsafe { llvm::LLVMRustTimeTraceProfilerInitialize() };
     }
 
     rustc_llvm::initialize_available_targets();
 
-    llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int, llvm_args.as_ptr());
+    unsafe { llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int, llvm_args.as_ptr()) };
 }
 
 pub fn time_trace_profiler_finish(file_name: &Path) {
@@ -442,8 +446,8 @@ pub(crate) fn print(req: &PrintRequest, mut out: &mut String, sess: &Session) {
             let cpu_cstring = CString::new(handle_native(sess.target.cpu.as_ref()))
                 .unwrap_or_else(|e| bug!("failed to convert to cstring: {}", e));
             unsafe extern "C" fn callback(out: *mut c_void, string: *const c_char, len: usize) {
-                let out = &mut *(out as *mut &mut String);
-                let bytes = slice::from_raw_parts(string as *const u8, len);
+                let out = unsafe { &mut *(out as *mut &mut String) };
+                let bytes = unsafe { slice::from_raw_parts(string as *const u8, len) };
                 write!(out, "{}", String::from_utf8_lossy(bytes)).unwrap();
             }
             unsafe {