[rust] [rust-server] More abstract functions including integer fitting #13503
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a follow up to my previous PR (#13231) which moves more functions into the
AbstractRustCodgen
.Three simple functions (
generatorLanguage
,escapeQuotationMark
,escapeUnsafeCharacters
) are identical and have just been cut-paste / de-duplicated.The rest of the changes relate to integer fitting. The new integer fitting code should be a lot more straightforward to understand and more consistent. It also has a much more extensive set of test cases that check the key boundary conditions.
This is however a very slightly breaking change, because there are some strange edge cases where the integer handling currently works differently in
rust
vsrust-server
, which have now been smoothed over. Again like the previous PR I have tried to maintain a compromise making the minimum changes to existing behaviour, but also trying to keep the code sane & consistent.cc: @frol @farcaller @richardwhiuk @paladinzh