From c9c1346874299b3dac07b3f310429c00fe91c998 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Fri, 24 Mar 2023 10:48:40 -0400 Subject: [PATCH] Clarify that we are doing ptr.addr() internally Co-authored-by: Ralf Jung --- compiler/rustc_mir_transform/src/check_alignment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_mir_transform/src/check_alignment.rs b/compiler/rustc_mir_transform/src/check_alignment.rs index d654c973e02..694102388cf 100644 --- a/compiler/rustc_mir_transform/src/check_alignment.rs +++ b/compiler/rustc_mir_transform/src/check_alignment.rs @@ -136,7 +136,7 @@ fn insert_alignment_check<'tcx>( .statements .push(Statement { source_info, kind: StatementKind::Assign(Box::new((thin_ptr, rvalue))) }); - // Cast the pointer to a usize + // Transmute the pointer to a usize (equivalent to `ptr.addr()`) let rvalue = Rvalue::Cast(CastKind::Transmute, Operand::Copy(thin_ptr), tcx.types.usize); let addr = local_decls.push(LocalDecl::with_source_info(tcx.types.usize, source_info)).into(); block_data