Skip to content

Commit 4c40153

Browse files
authoredFeb 24, 2024
Rollup merge of #121556 - GrigorenkoPV:addr_of, r=Nilstrieb
Use `addr_of!` As per #121303 (comment)
2 parents 9975e84 + 613cb32 commit 4c40153

File tree

42 files changed

+92
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+92
-83
lines changed
 

‎compiler/rustc_codegen_llvm/src/back/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn get_llvm_object_symbols(
313313
llvm::LLVMRustGetSymbols(
314314
buf.as_ptr(),
315315
buf.len(),
316-
&mut *state as *mut &mut _ as *mut c_void,
316+
std::ptr::addr_of_mut!(*state) as *mut c_void,
317317
callback,
318318
error_callback,
319319
)

‎compiler/rustc_codegen_llvm/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
169169
fn print_pass_timings(&self) {
170170
unsafe {
171171
let mut size = 0;
172-
let cstr = llvm::LLVMRustPrintPassTimings(&mut size as *mut usize);
172+
let cstr = llvm::LLVMRustPrintPassTimings(std::ptr::addr_of_mut!(size));
173173
if cstr.is_null() {
174174
println!("failed to get pass timings");
175175
} else {
@@ -182,7 +182,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
182182
fn print_statistics(&self) {
183183
unsafe {
184184
let mut size = 0;
185-
let cstr = llvm::LLVMRustPrintStatistics(&mut size as *mut usize);
185+
let cstr = llvm::LLVMRustPrintStatistics(std::ptr::addr_of_mut!(size));
186186
if cstr.is_null() {
187187
println!("failed to get pass stats");
188188
} else {

0 commit comments

Comments
 (0)