Skip to content

Commit

Permalink
The implement macro traits need not be recursively dependent (#2062)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Sep 23, 2022
1 parent a99189b commit 82feb3e
Show file tree
Hide file tree
Showing 81 changed files with 957 additions and 953 deletions.
10 changes: 7 additions & 3 deletions crates/libs/bindgen/src/implements.rs
Expand Up @@ -16,6 +16,7 @@ pub fn gen(gen: &Gen, def: TypeDef) -> TokenStream {
let features = gen.cfg_features(&cfg);
let mut requires = quote! {};
let type_ident = quote! { #type_ident<#generic_names> };
let vtables = gen.reader.type_def_vtables(def);

fn gen_required_trait(gen: &Gen, def: TypeDef, generics: &[Type]) -> TokenStream {
let name = gen.type_def_name_imp(def, generics, "_Impl");
Expand All @@ -26,10 +27,13 @@ pub fn gen(gen: &Gen, def: TypeDef) -> TokenStream {

let mut matches = quote! { iid == &<#type_ident as ::windows::core::Interface>::IID };

for def in gen.reader.type_def_vtables(def) {
if let Some(Type::TypeDef((def, _))) = vtables.last() {
requires.combine(&gen_required_trait(gen, *def, &[]))
}

for def in &vtables {
if let Type::TypeDef((def, generics)) = def {
requires.combine(&gen_required_trait(gen, def, &generics));
let name = gen.type_def_name(def, &generics);
let name = gen.type_def_name(*def, generics);

matches.combine(&quote! {
|| iid == &<#name as ::windows::core::Interface>::IID
Expand Down
@@ -1,5 +1,5 @@
#[cfg(feature = "Win32_Graphics_Direct3D12")]
pub trait IDMLBindingTable_Impl: Sized + IDMLObject_Impl + IDMLDeviceChild_Impl {
pub trait IDMLBindingTable_Impl: Sized + IDMLDeviceChild_Impl {
fn BindInputs(&self, bindingcount: u32, bindings: *const DML_BINDING_DESC);
fn BindOutputs(&self, bindingcount: u32, bindings: *const DML_BINDING_DESC);
fn BindTemporaryResource(&self, binding: *const DML_BINDING_DESC);
Expand Down Expand Up @@ -50,7 +50,7 @@ impl IDMLBindingTable_Vtbl {
}
}
#[cfg(feature = "Win32_Graphics_Direct3D12")]
pub trait IDMLCommandRecorder_Impl: Sized + IDMLObject_Impl + IDMLDeviceChild_Impl {
pub trait IDMLCommandRecorder_Impl: Sized + IDMLDeviceChild_Impl {
fn RecordDispatch(&self, commandlist: &::core::option::Option<super::super::super::Graphics::Direct3D12::ID3D12CommandList>, dispatchable: &::core::option::Option<IDMLDispatchable>, bindings: &::core::option::Option<IDMLBindingTable>);
}
#[cfg(feature = "Win32_Graphics_Direct3D12")]
Expand All @@ -69,7 +69,7 @@ impl IDMLCommandRecorder_Vtbl {
iid == &<IDMLCommandRecorder as ::windows::core::Interface>::IID || iid == &<IDMLObject as ::windows::core::Interface>::IID || iid == &<IDMLDeviceChild as ::windows::core::Interface>::IID
}
}
pub trait IDMLCompiledOperator_Impl: Sized + IDMLObject_Impl + IDMLDeviceChild_Impl + IDMLPageable_Impl + IDMLDispatchable_Impl {}
pub trait IDMLCompiledOperator_Impl: Sized + IDMLDispatchable_Impl {}
impl ::windows::core::RuntimeName for IDMLCompiledOperator {}
impl IDMLCompiledOperator_Vtbl {
pub const fn new<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: IDMLCompiledOperator_Impl, const OFFSET: isize>() -> IDMLCompiledOperator_Vtbl {
Expand Down Expand Up @@ -186,7 +186,7 @@ impl IDMLDevice_Vtbl {
}
}
#[cfg(feature = "Win32_Graphics_Direct3D12")]
pub trait IDMLDevice1_Impl: Sized + IDMLObject_Impl + IDMLDevice_Impl {
pub trait IDMLDevice1_Impl: Sized + IDMLDevice_Impl {
fn CompileGraph(&self, desc: *const DML_GRAPH_DESC, flags: DML_EXECUTION_FLAGS, riid: *const ::windows::core::GUID, ppv: *mut *mut ::core::ffi::c_void) -> ::windows::core::Result<()>;
}
#[cfg(feature = "Win32_Graphics_Direct3D12")]
Expand Down Expand Up @@ -222,7 +222,7 @@ impl IDMLDeviceChild_Vtbl {
iid == &<IDMLDeviceChild as ::windows::core::Interface>::IID || iid == &<IDMLObject as ::windows::core::Interface>::IID
}
}
pub trait IDMLDispatchable_Impl: Sized + IDMLObject_Impl + IDMLDeviceChild_Impl + IDMLPageable_Impl {
pub trait IDMLDispatchable_Impl: Sized + IDMLPageable_Impl {
fn GetBindingProperties(&self) -> DML_BINDING_PROPERTIES;
}
impl ::windows::core::RuntimeName for IDMLDispatchable {}
Expand Down Expand Up @@ -280,7 +280,7 @@ impl IDMLObject_Vtbl {
iid == &<IDMLObject as ::windows::core::Interface>::IID
}
}
pub trait IDMLOperator_Impl: Sized + IDMLObject_Impl + IDMLDeviceChild_Impl {}
pub trait IDMLOperator_Impl: Sized + IDMLDeviceChild_Impl {}
impl ::windows::core::RuntimeName for IDMLOperator {}
impl IDMLOperator_Vtbl {
pub const fn new<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: IDMLOperator_Impl, const OFFSET: isize>() -> IDMLOperator_Vtbl {
Expand All @@ -290,7 +290,7 @@ impl IDMLOperator_Vtbl {
iid == &<IDMLOperator as ::windows::core::Interface>::IID || iid == &<IDMLObject as ::windows::core::Interface>::IID || iid == &<IDMLDeviceChild as ::windows::core::Interface>::IID
}
}
pub trait IDMLOperatorInitializer_Impl: Sized + IDMLObject_Impl + IDMLDeviceChild_Impl + IDMLPageable_Impl + IDMLDispatchable_Impl {
pub trait IDMLOperatorInitializer_Impl: Sized + IDMLDispatchable_Impl {
fn Reset(&self, operatorcount: u32, operators: *const ::core::option::Option<IDMLCompiledOperator>) -> ::windows::core::Result<()>;
}
impl ::windows::core::RuntimeName for IDMLOperatorInitializer {}
Expand All @@ -307,7 +307,7 @@ impl IDMLOperatorInitializer_Vtbl {
iid == &<IDMLOperatorInitializer as ::windows::core::Interface>::IID || iid == &<IDMLObject as ::windows::core::Interface>::IID || iid == &<IDMLDeviceChild as ::windows::core::Interface>::IID || iid == &<IDMLPageable as ::windows::core::Interface>::IID || iid == &<IDMLDispatchable as ::windows::core::Interface>::IID
}
}
pub trait IDMLPageable_Impl: Sized + IDMLObject_Impl + IDMLDeviceChild_Impl {}
pub trait IDMLPageable_Impl: Sized + IDMLDeviceChild_Impl {}
impl ::windows::core::RuntimeName for IDMLPageable {}
impl IDMLPageable_Vtbl {
pub const fn new<Identity: ::windows::core::IUnknownImpl<Impl = Impl>, Impl: IDMLPageable_Impl, const OFFSET: isize>() -> IDMLPageable_Vtbl {
Expand Down
Expand Up @@ -50,7 +50,7 @@ impl IITDatabase_Vtbl {
}
}
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_System_Com"))]
pub trait IITPropList_Impl: Sized + super::super::System::Com::IPersist_Impl + super::super::System::Com::IPersistStreamInit_Impl {
pub trait IITPropList_Impl: Sized + super::super::System::Com::IPersistStreamInit_Impl {
fn Set(&self, propid: u32, lpszwstring: &::windows::core::PCWSTR, dwoperation: u32) -> ::windows::core::Result<()>;
fn Set2(&self, propid: u32, lpvdata: *mut ::core::ffi::c_void, cbdata: u32, dwoperation: u32) -> ::windows::core::Result<()>;
fn Set3(&self, propid: u32, dwdata: u32, dwoperation: u32) -> ::windows::core::Result<()>;
Expand Down

0 comments on commit 82feb3e

Please sign in to comment.