Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests do not compile on 32-bit architectures #325

Open
musicinmybrain opened this issue Dec 20, 2024 · 0 comments · May be fixed by #326
Open

Tests do not compile on 32-bit architectures #325

musicinmybrain opened this issue Dec 20, 2024 · 0 comments · May be fixed by #326

Comments

@musicinmybrain
Copy link

On i686:

$ git clone https://github.com/eminence/procfs.git
$ cd procfs
$ git checkout v0.17.0
$ cargo test
[…]
error[E0308]: mismatched types
    --> procfs/src/process/tests.rs:461:52
     |
461  |             assert_eq!(v, unsafe { libc::getauxval(k) });
     |                                    --------------- ^ expected `u32`, found `u64`
     |                                    |
     |                                    arguments to this function are incorrect
     |
note: function defined here
    --> /builddir/.cargo/registry/src/index.crates.io-1cd66030c949c28d/libc-0.2.169/src/unix/linux_like/linux/gnu/mod.rs:1340:12
     |
1340 |     pub fn getauxval(type_: c_ulong) -> c_ulong;
     |            ^^^^^^^^^
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
     |
461  |             assert_eq!(v, unsafe { libc::getauxval(k.try_into().unwrap()) });
     |                                                     ++++++++++++++++++++

error[E0308]: mismatched types   
   --> procfs/src/process/tests.rs:461:27
    |
461 |             assert_eq!(v, unsafe { libc::getauxval(k) });
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `u32`
    |
help: you can convert a `u32` to a `u64`
    |
461 |             assert_eq!(v, unsafe { libc::getauxval(k).into() });
    |                                                      +++++++

For more information about this error, try `rustc --explain E0308`.
warning: `procfs` (lib test) generated 2 warnings (1 duplicate)
error: could not compile `procfs` (lib test) due to 2 previous errors; 2 warnings emitted

The Rust compiler seems to have good suggestions; I’ll try them and open a PR.

musicinmybrain added a commit to musicinmybrain/procfs that referenced this issue Dec 20, 2024
musicinmybrain added a commit to musicinmybrain/procfs that referenced this issue Dec 20, 2024
musicinmybrain added a commit to musicinmybrain/procfs that referenced this issue Dec 20, 2024
@musicinmybrain musicinmybrain linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant