rigetti / rigetti/rigetti-pyo3

`impl_hash!` is incompatible with 32-bit word size

Open
#30 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
11
Forks
2
PR merge metrics
No merged PRs in 30d

Description

When building for 32-bit architectures, impl_hash! will cause a compilation failure:

error[E0308]: mismatched types
  --> ...\rigetti-pyo3-a2bd858c711b766b\d77377e\src\traits.rs:66:38
   |
58 | macro_rules! impl_hash {
   | ---------------------- in this expansion of `impl_hash!`
...
66 |                 isize::from_ne_bytes(bytes)
   |                 -------------------- ^^^^^ expected an array with a fixed size of 4 elements, found one with 8 elements
   |                 |
   |                 arguments to this function are incorrect

This is because bytes is the stored result of Hasher::finish, an i64, which can't be used to build an isize on 32-bit systems.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect src/traits.rs around the impl_hash! macro and the conversion of Hasher::finish output into isize. Confirm the expected behavior on a 32-bit target, then verify that the macro compiles for both 32-bit and 64-bit word sizes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.