diff options
author | Dmitry Kalyanov <Kalyanov.Dmitry@gmail.com> | 2014-12-27 23:47:16 +0300 |
---|---|---|
committer | Dmitry Kalyanov <Kalyanov.Dmitry@gmail.com> | 2014-12-27 23:47:16 +0300 |
commit | 6c01fa42936d4c5280822983299fa3e7765b17aa (patch) | |
tree | a113c8b634fe49202664b14676f9dda5f6750556 | |
parent | 4dcc4a0094ec43fb1778623d3cbb801946fbf0b8 (diff) |
Use by-ref compare instead of by-val compare in visit_composite.
When comparing type that has a pointer to itself, `==' may go into infinite recursion.
Comparing by reference avoids this. Since `c' and `ty_compinfo` are Rc<RefCell<..>>,
compare references to interior of RefCell.
-rw-r--r-- | src/parser.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs index 043c1ed4..2b54b7e8 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -317,7 +317,7 @@ fn visit_composite(cursor: &Cursor, parent: &Cursor, let is_composite = if cursor.cur_type().kind() == CXType_Unexposed { if let TComp(ref ty_compinfo) = ty { match members.last() { - Some(&CompMember::Comp(ref c)) => c == ty_compinfo, + Some(&CompMember::Comp(ref c)) => c.borrow().deref() as *const _ == ty_compinfo.borrow().deref() as *const _, _ => false } } else { false } |