summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index af202a02..0ad4e805 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -614,14 +614,20 @@ impl CodeGenerator for Type {
.resolve(ctx);
let name = item.canonical_name(ctx);
- // Try to catch the common pattern:
- //
- // typedef struct foo { ... } foo;
- //
- // here.
- //
- if inner_item.canonical_name(ctx) == name {
- return;
+ {
+ let through_type_aliases = inner.into_resolver()
+ .through_type_refs()
+ .through_type_aliases()
+ .resolve(ctx);
+
+ // Try to catch the common pattern:
+ //
+ // typedef struct foo { ... } foo;
+ //
+ // here, and also other more complex cases like #946.
+ if through_type_aliases.canonical_name(ctx) == name {
+ return;
+ }
}
// If this is a known named type, disallow generating anything