jkvargas / russimp

Assimp bindings for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Fails on MSVC Using the prebuilt Feature

AregevDev opened this issue · comments

Hello,
I cannot build the crate on my Windows 11 laptop, there seems to be a mismatched type error

error[E0308]: mismatched types
   --> C:\Users\Alon Regev\.cargo\registry\src\github.com-1ecc6299db9ec823\russimp-2.0.1\src\material.rs:123:49
    |
123 |         vec.push(get_texture_filename(material, texture_type_raw, index)?);
    |                  --------------------           ^^^^^^^^^^^^^^^^ expected `u32`, found `i32`
    |                  |
    |                  arguments to this function are incorrect
    |
note: function defined here
   --> C:\Users\Alon Regev\.cargo\registry\src\github.com-1ecc6299db9ec823\russimp-2.0.1\src\material.rs:129:4
    |
129 | fn get_texture_filename(
    |    ^^^^^^^^^^^^^^^^^^^^
130 |     material: &aiMaterial,
131 |     texture_type: u32,
    |     -----------------
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit
    |
123 |         vec.push(get_texture_filename(material, texture_type_raw.try_into().unwrap(), index)?);
    |                                                                 ++++++++++++++++++++

I believe aiTextureType is an untyped enum in the C++ source code, letting the implementation decide if it's underlying type will be signed or not. This doesn't occour on WSL2 for example.

To be honest, I have no idea how to solve this, you can always change the #[repr] type to i32 but I don't think it's a good solution.
Mind taking a look?

Just change the texture_type argument in get_texture_filename to aiTextureType 🤦
That compiles well.
I will create a PR for that