@@ -14,7 +14,6 @@ use super::template::{AsTemplateParam, TemplateInstantiation, TemplateParameters
14
14
use super :: traversal:: { EdgeKind , Trace , Tracer } ;
15
15
use clang:: { self , Cursor } ;
16
16
use parse:: { ClangItemParser , ParseError , ParseResult } ;
17
- use std:: cell:: Cell ;
18
17
use std:: io;
19
18
use std:: mem;
20
19
@@ -33,9 +32,6 @@ pub struct Type {
33
32
kind : TypeKind ,
34
33
/// Whether this type is const-qualified.
35
34
is_const : bool ,
36
- /// Don't go into an infinite loop when detecting if we have a vtable or
37
- /// not.
38
- detect_has_vtable_cycle : Cell < bool > ,
39
35
}
40
36
41
37
/// The maximum number of items in an array for which Rust implements common
@@ -75,7 +71,6 @@ impl Type {
75
71
layout : layout,
76
72
kind : kind,
77
73
is_const : is_const,
78
- detect_has_vtable_cycle : Cell :: new ( false ) ,
79
74
}
80
75
}
81
76
@@ -244,25 +239,15 @@ impl Type {
244
239
245
240
/// Whether this type has a vtable.
246
241
pub fn has_vtable ( & self , ctx : & BindgenContext ) -> bool {
247
- if self . detect_has_vtable_cycle . get ( ) {
248
- return false ;
249
- }
250
-
251
- self . detect_has_vtable_cycle . set ( true ) ;
252
-
253
242
// FIXME: Can we do something about template parameters? Huh...
254
- let result = match self . kind {
243
+ match self . kind {
255
244
TypeKind :: TemplateAlias ( t, _) |
256
245
TypeKind :: Alias ( t) |
257
246
TypeKind :: ResolvedTypeRef ( t) => ctx. resolve_type ( t) . has_vtable ( ctx) ,
258
247
TypeKind :: Comp ( ref info) => info. has_vtable ( ctx) ,
259
248
TypeKind :: TemplateInstantiation ( ref inst) => inst. has_vtable ( ctx) ,
260
249
_ => false ,
261
- } ;
262
-
263
- self . detect_has_vtable_cycle . set ( false ) ;
264
-
265
- result
250
+ }
266
251
}
267
252
268
253
/// Returns whether this type has a destructor.
0 commit comments