From 8a149555a994c1e3ac6eba620a2fafe8eb086a56 Mon Sep 17 00:00:00 2001 From: Arlie Davis Date: Tue, 21 May 2024 12:12:36 -0700 Subject: [PATCH] revert generics-related change --- crates/libs/implement/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/libs/implement/src/lib.rs b/crates/libs/implement/src/lib.rs index 9609ba5427..06c6536ab4 100644 --- a/crates/libs/implement/src/lib.rs +++ b/crates/libs/implement/src/lib.rs @@ -68,7 +68,7 @@ pub fn implement(attributes: proc_macro::TokenStream, original_type: proc_macro: let vtable_news = attributes.implement.iter().enumerate().map(|(enumerate, implement)| { let vtbl_ident = implement.to_vtbl_ident(); let offset = proc_macro2::Literal::isize_unsuffixed(-1 - enumerate as isize); - quote! { #vtbl_ident::new::<#impl_ident::#generics, #original_ident::#generics, #offset>() } + quote! { #vtbl_ident::new::() } }); let offset = attributes.implement.iter().enumerate().map(|(offset, _)| proc_macro2::Literal::usize_unsuffixed(offset)); @@ -135,6 +135,11 @@ pub fn implement(attributes: proc_macro::TokenStream, original_type: proc_macro: count: ::windows_core::imp::WeakRefCount, } + impl #generics #impl_ident::#generics where #constraints { + const VTABLES: (#(#vtbl_idents2,)*) = (#(#vtable_news,)*); + const IDENTITY: ::windows_core::IInspectable_Vtbl = ::windows_core::IInspectable_Vtbl::new::(); + } + impl #generics ::windows_core::ComObjectInner for #original_ident::#generics where #constraints { type Outer = #impl_ident::#generics; @@ -147,12 +152,9 @@ pub fn implement(attributes: proc_macro::TokenStream, original_type: proc_macro: // This is why this function returns ComObject instead of returning #impl_ident. fn into_object(self) -> ::windows_core::ComObject { - static VTABLES: (#(#vtbl_idents2,)*) = (#(#vtable_news,)*); - static IDENTITY: ::windows_core::IInspectable_Vtbl = ::windows_core::IInspectable_Vtbl::new::<#impl_ident::#generics, #identity_type, 0>(); - let boxed = ::windows_core::imp::Box::new(#impl_ident::#generics { - identity: &IDENTITY, - vtables: (#(&VTABLES.#offset,)*), + identity: &#impl_ident::#generics::IDENTITY, + vtables: (#(&#impl_ident::#generics::VTABLES.#offset,)*), this: self, count: ::windows_core::imp::WeakRefCount::new(), });