summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Fitzgerald <fitzgen@gmail.com>2017-09-29 17:52:15 -0700
committerNick Fitzgerald <fitzgen@gmail.com>2017-10-02 11:34:57 -0700
commit9220ffe0b485f0e2b1d0d59f25e3242bbdd552f7 (patch)
treecbb80979e753411820ca70ec5c11f3eb2cbfffc9
parentc780d9475020345b39e5f1c287fe22efb181e626 (diff)
Replacement should use TypeId rather than ItemId
-rw-r--r--src/ir/context.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ir/context.rs b/src/ir/context.rs
index f83435c6..aa268926 100644
--- a/src/ir/context.rs
+++ b/src/ir/context.rs
@@ -926,19 +926,19 @@ impl BindgenContext {
// We set this just after parsing the annotation. It's
// very unlikely, but this can happen.
if self.items.get(replacement).is_some() {
- replacements.push((*id, *replacement));
+ replacements.push((id.expect_type_id(self), replacement.expect_type_id(self)));
}
}
}
}
- for (id, replacement) in replacements {
- debug!("Replacing {:?} with {:?}", id, replacement);
+ for (id, replacement_id) in replacements {
+ debug!("Replacing {:?} with {:?}", id, replacement_id);
let new_parent = {
- let item = self.items.get_mut(&id).unwrap();
+ let item = self.items.get_mut(&id.into()).unwrap();
*item.kind_mut().as_type_mut().unwrap().kind_mut() =
- TypeKind::ResolvedTypeRef(replacement.as_type_id_unchecked());
+ TypeKind::ResolvedTypeRef(replacement_id);
item.parent_id()
};
@@ -947,7 +947,7 @@ impl BindgenContext {
//
// First, we'll make sure that its parent id is correct.
- let old_parent = self.resolve_item(replacement).parent_id();
+ let old_parent = self.resolve_item(replacement_id).parent_id();
if new_parent == old_parent {
// Same parent and therefore also same containing
// module. Nothing to do here.
@@ -955,7 +955,7 @@ impl BindgenContext {
}
self.items
- .get_mut(&replacement)
+ .get_mut(&replacement_id.into())
.unwrap()
.set_parent_for_replacement(new_parent);
@@ -970,7 +970,7 @@ impl BindgenContext {
.find(|id| {
let item = immut_self.resolve_item(*id);
item.as_module().map_or(false, |m| {
- m.children().contains(&replacement)
+ m.children().contains(&replacement_id.into())
})
})
};
@@ -997,7 +997,7 @@ impl BindgenContext {
.as_module_mut()
.unwrap()
.children_mut()
- .remove(&replacement);
+ .remove(&replacement_id.into());
self.items
.get_mut(&new_module)
@@ -1005,7 +1005,7 @@ impl BindgenContext {
.as_module_mut()
.unwrap()
.children_mut()
- .insert(replacement);
+ .insert(replacement_id.into());
}
}