Skip to content

[BUG] Webview fails to build on Windows 11 #209

@phha

Description

@phha

Describe the bug

error[E0277]: `*mut c_void` cannot be shared between threads safely
    --> src\main.rs:44:14
     |
  44 | static ICON: Lazy<Icon> = Lazy::new(|| {
     |              ^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely
     |
     = help: within `tao::platform_impl::platform::icon::RaiiIcon`, the trait `Sync` is not implemented for `*mut c_void`
note: required because it appears within the type `windows::Win32::UI::WindowsAndMessaging::HICON`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\windows-0.61.3\src\Windows\Win32\UI\WindowsAndMessaging\mod.rs:3962:12
     |
3962 | pub struct HICON(pub *mut core::ffi::c_void);
     |            ^^^^^
note: required because it appears within the type `tao::platform_impl::platform::icon::RaiiIcon`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tao-0.34.5\src\platform_impl\windows\icon.rs:61:8
     |
  61 | struct RaiiIcon {
     |        ^^^^^^^^
     = note: required for `Arc<tao::platform_impl::platform::icon::RaiiIcon>` to implement `Sync`
note: required because it appears within the type `tao::platform_impl::platform::icon::WinIcon`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tao-0.34.5\src\platform_impl\windows\icon.rs:66:12
     |
  66 | pub struct WinIcon {
     |            ^^^^^^^
note: required because it appears within the type `Icon`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tao-0.34.5\src\icon.rs:149:12
     |
 149 | pub struct Icon {
     |            ^^^^
     = note: required for `once_cell::imp::OnceCell<Icon>` to implement `Sync`
note: required because it appears within the type `once_cell::sync::OnceCell<Icon>`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\once_cell-1.21.3\src\lib.rs:901:16
     |
 901 |     pub struct OnceCell<T>(Imp<T>);
     |                ^^^^^^^^
     = note: required for `once_cell::sync::Lazy<Icon>` to implement `Sync`
     = note: shared static variables must have a type that implements `Sync`

error[E0277]: `*mut c_void` cannot be sent between threads safely
    --> src\main.rs:44:14
     |
  44 | static ICON: Lazy<Icon> = Lazy::new(|| {
     |              ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
     |
     = help: within `tao::platform_impl::platform::icon::RaiiIcon`, the trait `Send` is not implemented for `*mut c_void`
note: required because it appears within the type `windows::Win32::UI::WindowsAndMessaging::HICON`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\windows-0.61.3\src\Windows\Win32\UI\WindowsAndMessaging\mod.rs:3962:12
     |
3962 | pub struct HICON(pub *mut core::ffi::c_void);
     |            ^^^^^
note: required because it appears within the type `tao::platform_impl::platform::icon::RaiiIcon`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tao-0.34.5\src\platform_impl\windows\icon.rs:61:8
     |
  61 | struct RaiiIcon {
     |        ^^^^^^^^
     = note: required for `Arc<tao::platform_impl::platform::icon::RaiiIcon>` to implement `Sync`
note: required because it appears within the type `tao::platform_impl::platform::icon::WinIcon`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tao-0.34.5\src\platform_impl\windows\icon.rs:66:12
     |
  66 | pub struct WinIcon {
     |            ^^^^^^^
note: required because it appears within the type `Icon`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\tao-0.34.5\src\icon.rs:149:12
     |
 149 | pub struct Icon {
     |            ^^^^
     = note: required for `once_cell::imp::OnceCell<Icon>` to implement `Sync`
note: required because it appears within the type `once_cell::sync::OnceCell<Icon>`
    --> C:\Users\username\scoop\persist\rustup\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\once_cell-1.21.3\src\lib.rs:901:16
     |
 901 |     pub struct OnceCell<T>(Imp<T>);
     |                ^^^^^^^^
     = note: required for `once_cell::sync::Lazy<Icon>` to implement `Sync`
     = note: shared static variables must have a type that implements `Sync`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `tabnine_webview` (bin "tabnine_webview") due to 2 previous errors

To Reproduce
cargo build --release

Expected behavior
Webview compiles without error

Version Info:
rustc 1.91.1 (ed61e7d7e 2025-11-07)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions