Rust: move the call to ItemTreeVTable_static at mod level

... instead of having it in the drop implementation.
This is required to fix the `non_local_definitions` warning in nightly rust.

Part of #4706
This commit is contained in:
Olivier Goffart 2024-02-28 10:31:45 +01:00
parent c71b58e556
commit 100123901a

View file

@ -1428,11 +1428,14 @@ fn generate_item_tree(
#window_adapter_functions
}
const _ : () = {
use slint::private_unstable_api::re_exports::*;
ItemTreeVTable_static!(static VT for self::#inner_component_id);
};
impl sp::PinnedDrop for #inner_component_id {
fn drop(self: core::pin::Pin<&mut #inner_component_id>) {
use slint::private_unstable_api::re_exports::*;
ItemTreeVTable_static!(static VT for self::#inner_component_id);
new_vref!(let vref : VRef<sp::ItemTreeVTable> for sp::ItemTree = self.as_ref().get_ref());
sp::vtable::new_vref!(let vref : VRef<sp::ItemTreeVTable> for sp::ItemTree = self.as_ref().get_ref());
if let Some(wa) = self.maybe_window_adapter_impl() {
sp::unregister_item_tree(self.as_ref(), vref, Self::item_array(), &wa);
}