obv-mikhail / InputBot

Rust library for creating global hotkeys, and simulating inputs
MIT License
421 stars 74 forks source link

Panic on Rust 1.64.0 #64

Closed aisinker closed 2 years ago

aisinker commented 2 years ago

My little program build on Rust 1.64.0:

fn main(){
    Numpad0Key.press();
}

When I Running it:

thread 'main' panicked at 'cannot transmute_copy if U is larger than T', /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\core\src\mem\mod.rs:1057:5
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\std\src\panicking.rs:584
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library\core\src\panicking.rs:142
   2: core::mem::transmute_copy<winapi::um::winuser::KEYBDINPUT,winapi::um::winuser::INPUT_u>
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\core\src\mem\mod.rs:1057
   3: inputbot::windows::send_keybd_input
             at C:\Users\aisin\.cargo\git\checkouts\inputbot-ca044018c1f51f7c\b91aec3\src\windows\mod.rs:231
   4: enum$<inputbot::public::KeybdKey>::press
             at C:\Users\aisin\.cargo\git\checkouts\inputbot-ca044018c1f51f7c\b91aec3\src\windows\mod.rs:28
   5: remote_numpad_server::main
             at .\src\main.rs:20
   6: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52\library\core\src\ops\function.rs:248

Seem like because Rust 1.64.0 add a assertion on transmute_copy: Add assertion that transmute_copy's U is not larger than T