about summary refs log tree commit diff
diff options
context:
space:
mode:
authormichal kostrubiec <fractalfirdev@gmail.com>2025-06-26 11:00:31 +0200
committermichal kostrubiec <fractalfirdev@gmail.com>2025-06-26 11:00:31 +0200
commit413821fcbd3ac0f7448b37334f6fe60cb2bc10a3 (patch)
treedf0ad0060c74f0291a19f96ebc93db276c0a13cb
parentb03f7f87ff67d9589c51e56beac3734b0fb5349e (diff)
downloadrust-413821fcbd3ac0f7448b37334f6fe60cb2bc10a3.tar.gz
rust-413821fcbd3ac0f7448b37334f6fe60cb2bc10a3.zip
Remove unnecesary uses of the 'current_func' field, replacing it with a call to function.
-rw-r--r--src/intrinsic/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/intrinsic/mod.rs b/src/intrinsic/mod.rs
index 8401e78bd2f..4bebfee170b 100644
--- a/src/intrinsic/mod.rs
+++ b/src/intrinsic/mod.rs
@@ -426,7 +426,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
                 match int_type_width_signed(ty, self) {
                     Some((width, signed)) => match name {
                         sym::ctlz | sym::cttz => {
-                            let func = self.current_func.borrow().expect("func");
+                            let func = self.current_func();
                             let then_block = func.new_block("then");
                             let else_block = func.new_block("else");
                             let after_block = func.new_block("after");
@@ -1108,7 +1108,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
         // for (int counter = 0; value != 0; counter++) {
         //     value &= value - 1;
         // }
-        let func = self.current_func.borrow().expect("func");
+        let func = self.current_func();
         let loop_head = func.new_block("head");
         let loop_body = func.new_block("body");
         let loop_tail = func.new_block("tail");
@@ -1187,7 +1187,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
         let result_type = lhs.get_type();
         if signed {
             // Based on algorithm from: https://stackoverflow.com/a/56531252/389119
-            let func = self.current_func.borrow().expect("func");
+            let func = self.current_func();
             let res = func.new_local(self.location, result_type, "saturating_sum");
             let supports_native_type = self.is_native_int_type(result_type);
             let overflow = if supports_native_type {
@@ -1258,7 +1258,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
         let result_type = lhs.get_type();
         if signed {
             // Based on algorithm from: https://stackoverflow.com/a/56531252/389119
-            let func = self.current_func.borrow().expect("func");
+            let func = self.current_func();
             let res = func.new_local(self.location, result_type, "saturating_diff");
             let supports_native_type = self.is_native_int_type(result_type);
             let overflow = if supports_native_type {