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

Mismatched types on build to i686-pc-windows-msvc #2871

Closed
mars1211 opened this issue Apr 3, 2023 · 2 comments · Fixed by #3012
Closed

Mismatched types on build to i686-pc-windows-msvc #2871

mars1211 opened this issue Apr 3, 2023 · 2 comments · Fixed by #3012
Labels
bug Something is broken

Comments

@mars1211
Copy link

mars1211 commented Apr 3, 2023

[patch.crates-io]
egui = { version = "0.21.0", optional = true }
eframe = { version = "0.21.3", optional = true }

Describe the bug
I am building on win 11 x64 for the target i686-pc-windows-msvc, if I don't specify a target, then everything goes fine.

Console output

error[E0308]: mismatched types --> C:\Users\User\.cargo\registry\src\github.com-1ecc6299db9ec823\accesskit_windows-0.12.0\src\subclass.rs:69:67 | 69 | self.prev_wnd_proc = unsafe { transmute::(result) }; | --------------------------- ^^^^^^ expected `isize`, found `i32` | | | arguments to this function are incorrect | note: function defined here --> C:\Users\User\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\intrinsics.rs:1255:12 | 1255 | pub fn transmute(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::(result.try_into().unwrap()) }; | ++++++++++++++++++++

error[E0308]: mismatched types
--> C:\Users\User.cargo\registry\src\github.com-1ecc6299db9ec823\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:\Users\User.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(),
| ++++++++++++++++++++

For more information about this error, try rustc --explain E0308.
error: could not compile accesskit_windows due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

@mars1211 mars1211 added the bug Something is broken label Apr 3, 2023
@kitsuniru
Copy link

fix: disable accesskit feature for eframe in Cargo.toml

@pandarong
Copy link

Get the solution by reading the latest source code of accesskit. Manually edit accesskit_windows-0.12.0\src\subclass.rs, add in the file header: #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
type LongPtr = isize;
#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))]
type LongPtr = i32; then replace the isize bit with LongPtr. Compilation succeeded. This should be a problem with the accesskit version, and the egui update related dependencies to the latest should be able to solve it later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants