Skip to content

Commit 8f756be

Browse files
author
bors-servo
authored
Auto merge of #787 - SirVer:00_fix_repetition_operation, r=emilio
Remove Type::detect_has_vtable_cycle. After some discussion in #765 we do not think anymore that this can ever be true.
2 parents d0df1b9 + 672b740 commit 8f756be

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/ir/ty.rs

+2-17
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use super::template::{AsTemplateParam, TemplateInstantiation, TemplateParameters
1414
use super::traversal::{EdgeKind, Trace, Tracer};
1515
use clang::{self, Cursor};
1616
use parse::{ClangItemParser, ParseError, ParseResult};
17-
use std::cell::Cell;
1817
use std::io;
1918
use std::mem;
2019

@@ -33,9 +32,6 @@ pub struct Type {
3332
kind: TypeKind,
3433
/// Whether this type is const-qualified.
3534
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>,
3935
}
4036

4137
/// The maximum number of items in an array for which Rust implements common
@@ -75,7 +71,6 @@ impl Type {
7571
layout: layout,
7672
kind: kind,
7773
is_const: is_const,
78-
detect_has_vtable_cycle: Cell::new(false),
7974
}
8075
}
8176

@@ -244,25 +239,15 @@ impl Type {
244239

245240
/// Whether this type has a vtable.
246241
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-
253242
// FIXME: Can we do something about template parameters? Huh...
254-
let result = match self.kind {
243+
match self.kind {
255244
TypeKind::TemplateAlias(t, _) |
256245
TypeKind::Alias(t) |
257246
TypeKind::ResolvedTypeRef(t) => ctx.resolve_type(t).has_vtable(ctx),
258247
TypeKind::Comp(ref info) => info.has_vtable(ctx),
259248
TypeKind::TemplateInstantiation(ref inst) => inst.has_vtable(ctx),
260249
_ => false,
261-
};
262-
263-
self.detect_has_vtable_cycle.set(false);
264-
265-
result
250+
}
266251
}
267252

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

0 commit comments

Comments
 (0)