summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2016-11-04 11:05:21 -0700
committerNick Fitzgerald <fitzgen@gmail.com>2016-11-04 14:16:00 -0700
commitd14b602c4ee12e7f6efbbaa825124b7b774ac890 (patch)
tree86015ec1ecc5be6fe14ee367d2f5672694494087
parent0afbe48131359d2091734bac1bf6a1d54d48b914 (diff)
Use a known-resolved ItemId as a parent in partial specialization children
The `with_id` id will potentially end up unused if we find we already have an item (with its own distinct `ItemId`) for the type, so if we pass `with_id` as the parent id when parsing children it is potentially a dangling reference. Instead, use the canonical template declaration as the parent. It is already parsed and has a known-resolvable `ItemId`.
-rw-r--r--src/ir/context.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs
index c5c321c4..fc06375c 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -505,9 +505,15 @@ impl<'ctx> BindgenContext<'ctx> {
found_invalid_template_ref = true;
}
if c.kind() == CXCursor_TypeRef {
+ // The `with_id` id will potentially end up unused if we give up
+ // on this type (for example, its a tricky partial template
+ // specialization), so if we pass `with_id` as the parent, it is
+ // potentially a dangling reference. Instead, use the canonical
+ // template declaration as the parent. It is already parsed and
+ // has a known-resolvable `ItemId`.
let new_ty = Item::from_ty_or_ref(c.cur_type(),
Some(c),
- Some(with_id),
+ Some(wrapping),
self);
args.push(new_ty);
}