@@ -1749,46 +1749,49 @@ pub fn derive_setters(
1749
1749
. map ( |extends| {
1750
1750
extends
1751
1751
. split ( ',' )
1752
- . filter ( |extend| root_struct_names. contains ( * extend) )
1752
+ // .filter(|extend| root_struct_names.contains(*extend))
1753
1753
. map ( |extends| name_to_tokens ( & format ! ( "Extends{}" , name_to_tokens( & extends) ) ) )
1754
1754
. collect ( )
1755
1755
} )
1756
1756
. unwrap_or_else ( || vec ! [ ] ) ;
1757
1757
1758
- // We only implement a next methods for root structs with a `pnext` field.
1759
- let next_function = if has_next && root_structs. is_empty ( ) {
1760
- quote ! {
1761
- /// Prepends the given extension struct between the root and the first pointer. This
1762
- /// method only exists on structs that can be passed to a function directly. Only
1763
- /// valid extension structs can be pushed into the chain.
1764
- /// If the chain looks like `A -> B -> C`, and you call `builder.push_next(&mut D)`, then the
1765
- /// chain will look like `A -> D -> B -> C`.
1766
- pub fn push_next<T : #extends_name>( mut self , next: & ' a mut T ) -> #name_builder<' a> {
1767
- unsafe {
1768
- let next_ptr = next as * mut T as * mut BaseOutStructure ;
1769
- // `next` here can contain a pointer chain. This means that we must correctly
1770
- // attach he head to the root and the tail to the rest of the chain
1771
- // For example:
1772
- //
1773
- // next = A -> B
1774
- // Before: `Root -> C -> D -> E`
1775
- // After: `Root -> A -> B -> C -> D -> E`
1776
- // ^^^^^^
1777
- // next chain
1778
- let last_next = ptr_chain_iter( next) . last( ) . unwrap( ) ;
1779
- ( * last_next) . p_next = self . inner. p_next as _;
1780
- self . inner. p_next = next_ptr as _;
1758
+ // We only implement a push_next method for root structs with a `pnext` field.
1759
+ let next_function =
1760
+ if has_next && ( root_structs. is_empty ( ) || & _struct. name == "VkPhysicalDeviceFeatures2" ) {
1761
+ quote ! {
1762
+ /// Prepends the given extension struct between the root and the first pointer. This
1763
+ /// method only exists on structs that can be passed to a function directly. Only
1764
+ /// valid extension structs can be pushed into the chain.
1765
+ /// If the chain looks like `A -> B -> C`, and you call `builder.push_next(&mut D)`, then the
1766
+ /// chain will look like `A -> D -> B -> C`.
1767
+ pub fn push_next<T : #extends_name>( mut self , next: & ' a mut T ) -> #name_builder<' a> {
1768
+ unsafe {
1769
+ let next_ptr = next as * mut T as * mut BaseOutStructure ;
1770
+ // `next` here can contain a pointer chain. This means that we must correctly
1771
+ // attach the head to the root and the tail to the rest of the chain
1772
+ // For example:
1773
+ //
1774
+ // next = A -> B
1775
+ // Before: `Root -> C -> D -> E`
1776
+ // After: `Root -> A -> B -> C -> D -> E`
1777
+ // ^^^^^^
1778
+ // next chain
1779
+ let last_next = ptr_chain_iter( next) . last( ) . unwrap( ) ;
1780
+ ( * last_next) . p_next = self . inner. p_next as _;
1781
+ self . inner. p_next = next_ptr as _;
1782
+ }
1783
+ self
1781
1784
}
1782
- self
1783
1785
}
1784
- }
1785
- } else {
1786
- quote ! { }
1787
- } ;
1786
+ } else {
1787
+ quote ! { }
1788
+ } ;
1788
1789
1789
1790
// Root structs come with their own trait that structs that extends this struct will
1790
1791
// implement
1791
- let next_trait = if has_next && _struct. extends . is_none ( ) {
1792
+ let next_trait = if has_next
1793
+ && ( _struct. extends . is_none ( ) || & _struct. name == "VkPhysicalDeviceFeatures2" )
1794
+ {
1792
1795
quote ! {
1793
1796
pub unsafe trait #extends_name {
1794
1797
}
0 commit comments