@@ -167,6 +167,20 @@ impl Item {
167
167
self . kind ( ) . expect_function ( )
168
168
}
169
169
170
+ // This check is needed because even though the type might not contain the
171
+ // applicable template args itself, they might apply transitively via, for
172
+ // example, the parent.
173
+ //
174
+ // It's kind of unfortunate (in the sense that it's a sort of complex
175
+ // process, but I think it gets all the cases).
176
+ fn signature_contains_named_type ( & self , ctx : & BindgenContext , ty : & Type ) -> bool {
177
+ debug_assert ! ( ty. is_named( ) ) ;
178
+ self . expect_type ( ) . signature_contains_named_type ( ctx, ty) ||
179
+ self . applicable_template_args ( ctx) . iter ( ) . any ( |template| {
180
+ ctx. resolve_type ( * template) . signature_contains_named_type ( ctx, ty)
181
+ } )
182
+ }
183
+
170
184
pub fn applicable_template_args ( & self , ctx : & BindgenContext ) -> Vec < ItemId > {
171
185
let ty = match * self . kind ( ) {
172
186
ItemKind :: Type ( ref ty) => ty,
@@ -197,7 +211,8 @@ impl Item {
197
211
TypeKind :: Alias ( _, inner) => {
198
212
let parent_args = ctx. resolve_item ( self . parent_id ( ) )
199
213
. applicable_template_args ( ctx) ;
200
- let inner = ctx. resolve_type ( inner) ;
214
+ let inner = ctx. resolve_item ( inner) ;
215
+
201
216
// Avoid unused type parameters, sigh.
202
217
parent_args. iter ( ) . cloned ( ) . filter ( |arg| {
203
218
let arg = ctx. resolve_type ( * arg) ;
0 commit comments