@@ -248,19 +248,22 @@ impl Item {
248
248
debug_assert ! ( ctx. in_codegen_phase( ) ,
249
249
"You're not supposed to call this yet" ) ;
250
250
self . annotations . hide ( ) ||
251
- ctx. hidden_by_name ( & self . real_canonical_name ( ctx, false ) )
251
+ ctx. hidden_by_name ( & self . real_canonical_name ( ctx, false , true ) )
252
252
}
253
253
254
254
pub fn is_opaque ( & self , ctx : & BindgenContext ) -> bool {
255
255
debug_assert ! ( ctx. in_codegen_phase( ) ,
256
256
"You're not supposed to call this yet" ) ;
257
257
self . annotations . opaque ( ) ||
258
- ctx. opaque_by_name ( & self . real_canonical_name ( ctx, false ) )
258
+ ctx. opaque_by_name ( & self . real_canonical_name ( ctx, false , true ) )
259
259
}
260
260
261
261
/// Get the canonical name without taking into account the replaces
262
262
/// annotation.
263
- fn real_canonical_name ( & self , ctx : & BindgenContext , count_namespaces : bool ) -> String {
263
+ fn real_canonical_name ( & self ,
264
+ ctx : & BindgenContext ,
265
+ count_namespaces : bool ,
266
+ for_name_checking : bool ) -> String {
264
267
let base_name = match * self . kind ( ) {
265
268
ItemKind :: Type ( ref ty) => {
266
269
match * ty. kind ( ) {
@@ -288,7 +291,10 @@ impl Item {
288
291
// that case the referenced type is the inner alias, so
289
292
// we're good there. If we wouldn't, a more complex solution
290
293
// would be needed.
291
- TypeKind :: TemplateAlias ( ..) => {
294
+ TypeKind :: TemplateAlias ( inner, _) => {
295
+ if for_name_checking {
296
+ return ctx. resolve_item ( inner) . real_canonical_name ( ctx, count_namespaces, false ) ;
297
+ }
292
298
Some ( "" )
293
299
}
294
300
// Else use the proper name, or fallback to a name with an
@@ -682,7 +688,7 @@ impl ItemCanonicalName for Item {
682
688
if let Some ( other_canon_type) = self . annotations . use_instead_of ( ) {
683
689
return other_canon_type. to_owned ( ) ;
684
690
}
685
- self . real_canonical_name ( ctx, ctx. options ( ) . enable_cxx_namespaces )
691
+ self . real_canonical_name ( ctx, ctx. options ( ) . enable_cxx_namespaces , false )
686
692
}
687
693
}
688
694
@@ -730,7 +736,7 @@ impl ItemCanonicalPath for Item {
730
736
debug_assert ! ( is_alias, "How can this ever happen?" ) ;
731
737
parent_path. pop ( ) . unwrap ( ) ;
732
738
}
733
- parent_path. push ( self . real_canonical_name ( ctx, true ) ) ;
739
+ parent_path. push ( self . real_canonical_name ( ctx, true , false ) ) ;
734
740
735
741
parent_path
736
742
}
0 commit comments