diff options
| author | antoyo <antoyo@users.noreply.github.com> | 2025-06-26 09:22:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-26 09:22:52 -0400 |
| commit | 98d65f234f25f2a9145e2cfdc071507b7486e210 (patch) | |
| tree | 7c3f1b492b2114e25086d32709e9e7b97cb2b42b | |
| parent | 79564c86d1249af6630a92ef4b4f8d2280dbf029 (diff) | |
| parent | 413821fcbd3ac0f7448b37334f6fe60cb2bc10a3 (diff) | |
| download | rust-98d65f234f25f2a9145e2cfdc071507b7486e210.tar.gz rust-98d65f234f25f2a9145e2cfdc071507b7486e210.zip | |
Merge pull request #722 from FractalFir/func_refactor
Remove unnecesary uses of the 'current_func' field, replacing it with a call to function.
| -rw-r--r-- | src/intrinsic/mod.rs | 8 |
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 { |
