Skip to content

Commit 64afe6d

Browse files
committed
Remove Type::detect_has_vtable_cycle.
After some discussion in rust-lang#765 we do not think anymore this it can ever be true.
1 parent d0df1b9 commit 64afe6d

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

src/ir/ty.rs

+2-16
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ pub struct Type {
3333
kind: TypeKind,
3434
/// Whether this type is const-qualified.
3535
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>,
3936
}
4037

4138
/// The maximum number of items in an array for which Rust implements common
@@ -75,7 +72,6 @@ impl Type {
7572
layout: layout,
7673
kind: kind,
7774
is_const: is_const,
78-
detect_has_vtable_cycle: Cell::new(false),
7975
}
8076
}
8177

@@ -244,25 +240,15 @@ impl Type {
244240

245241
/// Whether this type has a vtable.
246242
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-
253243
// FIXME: Can we do something about template parameters? Huh...
254-
let result = match self.kind {
244+
match self.kind {
255245
TypeKind::TemplateAlias(t, _) |
256246
TypeKind::Alias(t) |
257247
TypeKind::ResolvedTypeRef(t) => ctx.resolve_type(t).has_vtable(ctx),
258248
TypeKind::Comp(ref info) => info.has_vtable(ctx),
259249
TypeKind::TemplateInstantiation(ref inst) => inst.has_vtable(ctx),
260250
_ => false,
261-
};
262-
263-
self.detect_has_vtable_cycle.set(false);
264-
265-
result
251+
}
266252
}
267253

268254
/// Returns whether this type has a destructor.

0 commit comments

Comments
 (0)