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

Build Fails on 32-Bit Windows #246

Closed
Teh-Bobo opened this issue Apr 29, 2023 · 2 comments
Closed

Build Fails on 32-Bit Windows #246

Teh-Bobo opened this issue Apr 29, 2023 · 2 comments

Comments

@Teh-Bobo
Copy link

When building with a toolchain target of i686-pc-windows-msvc building the crate fails with the following two errors:

error[E0308]: mismatched types
    --> C:\--snip--\accesskit_windows-0.12.0\src\subclass.rs:69:67
     |
69   |         self.prev_wnd_proc = unsafe { transmute::<isize, WNDPROC>(result) };
     |                                       --------------------------- ^^^^^^ expected `isize`, found `i32`
     |                                       |
     |                                       arguments to this function are incorrect
     |
note: function defined here
    --> C:\--snip--\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\intrinsics.rs:1251:12
     |
1251 |     pub fn transmute<Src, Dst>(src: Src) -> Dst;
     |            ^^^^^^^^^
help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
     |
69   |         self.prev_wnd_proc = unsafe { transmute::<isize, WNDPROC>(result.try_into().unwrap()) };
     |                                                                         ++++++++++++++++++++


and

error[E0308]: mismatched types
    --> C:\--snip--\accesskit_windows-0.12.0\src\subclass.rs:80:17
     |
77   |             SetWindowLongPtrW(
     |             ----------------- arguments to this function are incorrect
...
80   |                 transmute::<WNDPROC, isize>(self.prev_wnd_proc),
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `isize`
     |
note: function defined here
    --> C:\--snip--\.cargo\registry\src\github.com-1ecc6299db9ec823\windows-0.42.0\src\Windows\Win32\UI\WindowsAndMessaging\mod.rs:4776:15
     |
4776 | pub unsafe fn SetWindowLongW<'a, P0>(hwnd: P0, nindex: WINDOW_LONG_PTR_INDEX, dwnewlong: i32) -> i32
     |               ^^^^^^^^^^^^^^
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
     |
80   |                 transmute::<WNDPROC, isize>(self.prev_wnd_proc).try_into().unwrap(),
     |                                                                ++++++++++++++++++++

Best I can tell, you're using SetWindowLongPtrW which returns an isize; however, the windows crate has these few lines (in "WindowsAndMessaging/mod.rs":15914):

#[cfg(target_pointer_width = "32")]
#[cfg(feature = "Win32_Foundation")]
pub use SetWindowLongW as SetWindowLongPtrW;

This replaceses SetWindowLongPtrW with SetWindowLongW which returns an i32 instead of an isize. I have not done much work in the depths of Win32, so I have no idea why that would be. It seems like a silly choice to make on the surface.

@DataTriny
Copy link
Member

Hi @Teh-Bobo ,

I think the issue you're hitting has been fixed in #223 and included in accesskit_windows 0.13.2. From the error messages it looks like you're using version 0.12.0. Can you please update your version and let us know if it solves your issue?

Thanks.

@Teh-Bobo
Copy link
Author

Teh-Bobo commented Apr 30, 2023

That fix looks like exactly what would be causing the issue. Your crate is actually used by egui, a gui library that I'm using. I'll submit an issue for them to update their library. Thanks for the quick response.

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

No branches or pull requests

2 participants