mattwparas / steel

An embedded scheme interpreter in Rust
Apache License 2.0
980 stars 46 forks source link

commit d2d036 introduces a "mismatched types" error when building for wasm32 #221

Closed nicx256 closed 3 weeks ago

nicx256 commented 3 weeks ago

trying to compile commit d2d036 "Shrink the instruction size, function size (#208)" on wasm32 produces build errors with (at least) the nightly compiler:

error[E0308]: mismatched types
    --> /home/user/.cargo/git/checkouts/steel-e2d1e283aa82877c/a5dc6a4/crates/steel-core/src/core/instructions.rs:150:30
     |
150  |         usize::from_le_bytes([a, b, c, 0, 0, 0, 0, 0])
     |         -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected an array with a fixed size of 4 elements, found one with 8 elements
     |         |
     |         arguments to this function are incorrect
     |
note: associated function defined here
    --> /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/num/mod.rs:1244:5
     |
1244 | /     uint_impl! {
1245 | |         Self = usize,
1246 | |         ActualT = u32,
1247 | |         SignedT = isize,
...    |
1261 | |         bound_condition = " on 32-bit targets",
1262 | |     }
     | |_____^
     = note: this error originates in the macro `uint_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0308`.
error: could not compile `steel-core` (lib) due to 1 previous error
mattwparas commented 3 weeks ago

I think I got a fix on #222 - would you mind confirming that this fixes the issue? I'll also add a step to compile against wasm32 in the CI

nicx256 commented 3 weeks ago

will test it tomorrow and report back (in about 12 hrs time, sorry)

nicx256 commented 3 weeks ago

@mattwparas yep, that fixed it

mattwparas commented 3 weeks ago

Awesome, closed by #222 - I've added a step to build wasm32-unknown-unknown now so hopefully this doesn't happen again :smile: