diff options
author | Nick Fitzgerald <fitzgen@gmail.com> | 2016-12-02 14:57:56 -0800 |
---|---|---|
committer | Nick Fitzgerald <fitzgen@gmail.com> | 2016-12-02 14:57:56 -0800 |
commit | 8c4482592c31d3d50f82cee0058b51ac90c31de3 (patch) | |
tree | 5963089283ad20fed3dead09566f1abbf151843f | |
parent | 12ee656be8dbacb49179060763830c08a5202156 (diff) |
Assert that we do not infinitely loop in ir::Item::name_target
This re-uses the infrastructure used when asserting that
`ItemAncestorsIter` does not infinitely loop in `ir::Item::name_target`.
-rw-r--r-- | libbindgen/src/ir/item.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libbindgen/src/ir/item.rs b/libbindgen/src/ir/item.rs index f4272e2d..74c65083 100644 --- a/libbindgen/src/ir/item.rs +++ b/libbindgen/src/ir/item.rs @@ -588,8 +588,13 @@ impl Item { ctx: &BindgenContext, for_name_checking: bool) -> ItemId { + let mut targets_seen = AncestorsSeen::new(); let mut item = self; + loop { + debug_assert!(!targets_seen.contains(&item.id())); + targets_seen.insert(item.id()); + match *item.kind() { ItemKind::Type(ref ty) => { match *ty.kind() { |