Skip to content

Commit

Permalink
Auto merge of rust-lang#121569 - matthiaskrgr:rollup-awglrax, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121343 (Add examples for some methods on slices)
 - rust-lang#121374 (match lowering: Split off `test_candidates` into several functions and improve comments)
 - rust-lang#121474 (Ignore compiletest test directive migration commits)
 - rust-lang#121515 (promotion: don't promote int::MIN / -1)
 - rust-lang#121530 (Fix incorrect doc of ScopedJoinHandle::is_finished)
 - rust-lang#121551 (Forbid use of `extern "C-unwind"` inside standard library)
 - rust-lang#121556 (Use `addr_of!`)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Feb 24, 2024
2 parents 381d699 + 4c40153 commit 2ae1bb6
Show file tree
Hide file tree
Showing 57 changed files with 592 additions and 970 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ f97fddab91fbf290ea5b691fe355d6f915220b6e
cc907f80b95c6ec530c5ee1b05b044a468f07eca
# format let-chains
b2d2184edea578109a48ec3d8decbee5948e8f35
# test directives migration
6e48b96692d63a79a14563f27fe5185f122434f8
ec2cc761bc7067712ecc7734502f703fe3b024c8
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ fn get_llvm_object_symbols(
llvm::LLVMRustGetSymbols(
buf.as_ptr(),
buf.len(),
&mut *state as *mut &mut _ as *mut c_void,
std::ptr::addr_of_mut!(*state) as *mut c_void,
callback,
error_callback,
)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
fn print_pass_timings(&self) {
unsafe {
let mut size = 0;
let cstr = llvm::LLVMRustPrintPassTimings(&mut size as *mut usize);
let cstr = llvm::LLVMRustPrintPassTimings(std::ptr::addr_of_mut!(size));
if cstr.is_null() {
println!("failed to get pass timings");
} else {
Expand All @@ -182,7 +182,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
fn print_statistics(&self) {
unsafe {
let mut size = 0;
let cstr = llvm::LLVMRustPrintStatistics(&mut size as *mut usize);
let cstr = llvm::LLVMRustPrintStatistics(std::ptr::addr_of_mut!(size));
if cstr.is_null() {
println!("failed to get pass stats");
} else {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ pub(crate) fn print(req: &PrintRequest, mut out: &mut dyn PrintBackendInfo, sess
&tm,
cpu_cstring.as_ptr(),
callback,
&mut out as *mut &mut dyn PrintBackendInfo as *mut c_void,
std::ptr::addr_of_mut!(out) as *mut c_void,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl<T> RwLock<T> {
#[inline(always)]
pub fn leak(&self) -> &T {
let guard = self.read();
let ret = unsafe { &*(&*guard as *const T) };
let ret = unsafe { &*std::ptr::addr_of!(*guard) };
std::mem::forget(guard);
ret
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl<'sess> OnDiskCache<'sess> {

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

/// Encode something with additional information that allows to do some
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<T> List<T> {
// length) that is 64-byte aligned, thus featuring the necessary
// trailing padding for elements with up to 64-byte alignment.
static EMPTY_SLICE: InOrder<usize, MaxAlign> = InOrder(0, MaxAlign);
unsafe { &*(&EMPTY_SLICE as *const _ as *const List<T>) }
unsafe { &*(std::ptr::addr_of!(EMPTY_SLICE) as *const List<T>) }
}

pub fn len(&self) -> usize {
Expand Down
Loading

0 comments on commit 2ae1bb6

Please sign in to comment.