Rodrigodd opened PR #5316 from fix-FunctionBuilder-API to main:
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[x] This has been discussed in issue #..., or if not, please tell us why
here.[x] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[x] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.
-->
Here on this zulip stream, I have asked about some inconsistencies in theFunctionBuilderContextandFunctionBuilderAPIs, and it was suggested that I could probably fix these issues. This PR addresses two of them.
FunctionBuilderis supposed to be used to only build a singleFunction, butFunctionBuilder::finalize()indicates that it can be used for multiplesFunctions. The first commit fixed that by makingfinalize()consumeself. Nowhere in the codebaseFunctionBuilderwas reused, so the change was very straight forward.The other one was that
FunctionBuilder::funcwas public, which could allow theFunctionto be messed up mid-translation. I tried replacing it by an immutablefunc()getter, but in the codebasefuncis in fact messed with mid-translation. So, I also added afunc_mut()getter. I am not sure if this change brings meaningful benefits, so I could remove it if you prefer.
jameysharp submitted PR review.
bjorn3 created PR review comment:
cg_clif uses
fx.builder.finalize()in a function takingfxby mutable reference. As such moving out is not allowed. It should be possible to change this though.
bjorn3 submitted PR review.
Rodrigodd updated PR #5316 from fix-FunctionBuilder-API to main.
Rodrigodd updated PR #5316 from fix-FunctionBuilder-API to main.
Rodrigodd requested bjorn3 for a review on PR #5316.
Rodrigodd requested jameysharp for a review on PR #5316.
Rodrigodd requested bjorn3 for a review on PR #5316.
Rodrigodd requested jameysharp for a review on PR #5316.
Rodrigodd requested bjorn3 for a review on PR #5316.
Rodrigodd requested jameysharp for a review on PR #5316.
bjorn3 submitted PR review.
Rodrigodd updated PR #5316 from fix-FunctionBuilder-API to main.
jameysharp has enabled auto merge for PR #5316.
jameysharp merged PR #5316.
Last updated: Dec 06 2025 at 06:05 UTC