about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2025-07-22 11:16:06 -0400
committerAntoni Boucher <bouanto@zoho.com>2025-07-22 11:16:06 -0400
commit27f3a97747cd46676c4fe2a4afd77009f3b98a46 (patch)
tree496f7df5f3981cb4ee703ac8cf664152a9361855
parenta4fb5794e60883625fed8d25e9e55c649f9fb70c (diff)
downloadrust-27f3a97747cd46676c4fe2a4afd77009f3b98a46.tar.gz
rust-27f3a97747cd46676c4fe2a4afd77009f3b98a46.zip
Use a bitcast in Builder::ret to support non-native integers
-rw-r--r--src/builder.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/builder.rs b/src/builder.rs
index a4ec4bf8dea..3cd464b61e1 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -540,8 +540,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
     fn ret(&mut self, mut value: RValue<'gcc>) {
         let expected_return_type = self.current_func().get_return_type();
         if !expected_return_type.is_compatible_with(value.get_type()) {
-            // NOTE: due to opaque pointers now being used, we need to cast here.
-            value = self.context.new_cast(self.location, value, expected_return_type);
+            // NOTE: due to opaque pointers now being used, we need to bitcast here.
+            value = self.context.new_bitcast(self.location, value, expected_return_type);
         }
         self.llbb().end_with_return(self.location, value);
     }