about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-05-22 15:19:15 +0200
committerAntoni Boucher <bouanto@zoho.com>2024-07-02 12:24:11 -0400
commitdd4a546de0af391759a901ac070e6ca66a6c7af1 (patch)
treee295b350fbdb1d18d817f954cebe9e6fd4c981d0
parent527c04958469c3d8701d3ab0dedb16fa396a7900 (diff)
downloadrust-dd4a546de0af391759a901ac070e6ca66a6c7af1.tar.gz
rust-dd4a546de0af391759a901ac070e6ca66a6c7af1.zip
Add explanations for ptr func call argument cast
-rw-r--r--src/builder.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/builder.rs b/src/builder.rs
index c5819ff93d7..0d5ef42833d 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -253,6 +253,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
                         self.context.new_cast(self.location, actual_val, expected_ty)
                     } else if on_stack_param_indices.contains(&index) {
                         let ty = actual_val.get_type();
+                        // It's possible that the value behind the pointer is actually not exactly
+                        // the expected type, so to go around that, we add a cast before
+                        // dereferencing the value.
                         if let Some(pointee_val) = ty.get_pointee()
                             && pointee_val != expected_ty
                         {