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

Change Arch repr to u32 instead of isize to support wasm32 targets #260

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

maximebedard
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR removes the clippy unportable warning and changes the internal representation of Arch from a isize to a u32. This makes the type portable across other architecture (e.g. WASM32). See the following example:

cargo build --target wasm32-unknown-unknown
   Compiling oci-spec v0.7.1
error: literal out of range for `isize`
    --> src/runtime/linux.rs:1112:22
     |
1112 |     ScmpArchX86_64 = 0xc000003e,
     |                      ^^^^^^^^^^
     |
     = note: the literal `0xc000003e` (decimal `3221225534`) does not fit into the type `isize` and will become `-1073741762isize`
     = note: `#[deny(overflowing_literals)]` on by default

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

N/A

Does this PR introduce a user-facing change?

Anyone relying on Arch type to be a usize will have to explicitly convert it to a u32.


@flavio flavio merged commit e1dded7 into youki-dev:main Nov 25, 2024
13 checks passed
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 this pull request may close these issues.

3 participants