Fixed a compilation error (cargo install reform) in deserialize_integer - #2
Open
tueda wants to merge 1 commit into
Open
Fixed a compilation error (cargo install reform) in deserialize_integer#2tueda wants to merge 1 commit into
tueda wants to merge 1 commit into
Conversation
"cargo install reform" failed because - Cargo.toml specifies gmp-mpfr-sys 1.1.4 (which means ^1.1.4), - "cargo install" doesn't care Cargo.lock, so the latest version of gmp-mpfr-sys (currently 1.4.2) is used, - Since gmp_mpfr_sys 1.3.0, the internal structure of mpz_t has been changed slightly, using std::ptr::NonNull (introduced in Rust 1.25) instead of raw pointers, which breaks the code in deserialize_integer. To fix the issue, this patch adopts the safest way to do the same thing as the old code: - use std::mem::MaybeUninit::uninit (introduced in Rust 1.36), - call gmp_mpfr_sys::gmp::mpz_init.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 patch fixes
cargo install reformfailure due to a change ingmp-mpfr-sys1.3.0 (namely,gmp::mpz_t). The patch usesstd::mem::MaybeUninit::uninitandgmp_mpfr_sys::gmp::mpz_init..Other possible workarounds are, if you like to take,
gmp-mpfr-sysas~1.1.4inCargo.toml,or
mpz_taswhich should work as the old code, though it is uncertain in GMP/gmp_mpfr_sys documents and may change in future.