Skip to content

Commit 2ae1bb6

Browse files
committed
Auto merge of #121569 - matthiaskrgr:rollup-awglrax, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #121343 (Add examples for some methods on slices) - #121374 (match lowering: Split off `test_candidates` into several functions and improve comments) - #121474 (Ignore compiletest test directive migration commits) - #121515 (promotion: don't promote int::MIN / -1) - #121530 (Fix incorrect doc of ScopedJoinHandle::is_finished) - #121551 (Forbid use of `extern "C-unwind"` inside standard library) - #121556 (Use `addr_of!`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 381d699 + 4c40153 commit 2ae1bb6

Some content is hidden

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

57 files changed

+592
-970
lines changed

.git-blame-ignore-revs

+3
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ f97fddab91fbf290ea5b691fe355d6f915220b6e
2020
cc907f80b95c6ec530c5ee1b05b044a468f07eca
2121
# format let-chains
2222
b2d2184edea578109a48ec3d8decbee5948e8f35
23+
# test directives migration
24+
6e48b96692d63a79a14563f27fe5185f122434f8
25+
ec2cc761bc7067712ecc7734502f703fe3b024c8

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 {

compiler/rustc_codegen_llvm/src/llvm_util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ pub(crate) fn print(req: &PrintRequest, mut out: &mut dyn PrintBackendInfo, sess
435435
&tm,
436436
cpu_cstring.as_ptr(),
437437
callback,
438-
&mut out as *mut &mut dyn PrintBackendInfo as *mut c_void,
438+
std::ptr::addr_of_mut!(out) as *mut c_void,
439439
);
440440
}
441441
}

compiler/rustc_data_structures/src/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ impl<T> RwLock<T> {
429429
#[inline(always)]
430430
pub fn leak(&self) -> &T {
431431
let guard = self.read();
432-
let ret = unsafe { &*(&*guard as *const T) };
432+
let ret = unsafe { &*std::ptr::addr_of!(*guard) };
433433
std::mem::forget(guard);
434434
ret
435435
}

compiler/rustc_middle/src/query/on_disk_cache.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ impl<'sess> OnDiskCache<'sess> {
233233

234234
for (index, file) in files.iter().enumerate() {
235235
let index = SourceFileIndex(index as u32);
236-
let file_ptr: *const SourceFile = &**file as *const _;
236+
let file_ptr: *const SourceFile = std::ptr::addr_of!(**file);
237237
file_to_file_index.insert(file_ptr, index);
238238
let source_file_id = EncodedSourceFileId::new(tcx, file);
239239
file_index_to_stable_id.insert(index, source_file_id);
@@ -835,7 +835,7 @@ pub struct CacheEncoder<'a, 'tcx> {
835835
impl<'a, 'tcx> CacheEncoder<'a, 'tcx> {
836836
#[inline]
837837
fn source_file_index(&mut self, source_file: Lrc<SourceFile>) -> SourceFileIndex {
838-
self.file_to_file_index[&(&*source_file as *const SourceFile)]
838+
self.file_to_file_index[&std::ptr::addr_of!(*source_file)]
839839
}
840840

841841
/// Encode something with additional information that allows to do some

compiler/rustc_middle/src/ty/list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<T> List<T> {
6161
// length) that is 64-byte aligned, thus featuring the necessary
6262
// trailing padding for elements with up to 64-byte alignment.
6363
static EMPTY_SLICE: InOrder<usize, MaxAlign> = InOrder(0, MaxAlign);
64-
unsafe { &*(&EMPTY_SLICE as *const _ as *const List<T>) }
64+
unsafe { &*(std::ptr::addr_of!(EMPTY_SLICE) as *const List<T>) }
6565
}
6666

6767
pub fn len(&self) -> usize {

0 commit comments

Comments
 (0)