give Pointer::into_parts a more scary name and offer a safer alternative

This commit is contained in:
Ralf Jung
2025-06-28 15:20:33 +02:00
parent d41e12f1f4
commit 58dce8ca86
17 changed files with 47 additions and 38 deletions

View File

@@ -261,7 +261,7 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> {
}
}
Scalar::Ptr(ptr, _size) => {
let (prov, offset) = ptr.into_parts(); // we know the `offset` is relative
let (prov, offset) = ptr.prov_and_relative_offset();
let alloc_id = prov.alloc_id();
let base_addr = match self.tcx.global_alloc(alloc_id) {
GlobalAlloc::Memory(alloc) => {