Open kawadakk opened 1 year ago
Given a Vala interface method:
public virtual async void hoge_async() {}
gir generates the following trampoline:
unsafe extern "C" fn hoge_async_trampoline<P: FnOnce(()) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) { let _ = ffi::foo_bar_hoge_finish(_source_object as *mut _, res); let callback: Box_<glib::thread_guard::ThreadGuard<P>> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); // error[E0425]: cannot find value `result` in this scope }
This is where the problematic line is generated: https://github.com/gtk-rs/gir/blob/3a2fdae0a42b47a66c33fbd295594f2c22bba295/src/codegen/function_body_chunk.rs#L895-L898
Given a Vala interface method:
gir generates the following trampoline: