Skip to content

Commit d6601d8

Browse files
committed
---
yaml --- r: 68465 b: refs/heads/auto c: 050d0e6 h: refs/heads/master i: 68463: bccae49 v: v3
1 parent 3b8f46e commit d6601d8

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 47afb33981c7f20d33e04b938c4362f4da12529a
17+
refs/heads/auto: 050d0e6b29d19978584f6e389f53612497b7e41e
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/librustc/lib/llvm.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,12 +2149,17 @@ impl TypeNames {
21492149
self.named_types.find_equiv(&s).map_consume(|x| Type::from_ref(*x))
21502150
}
21512151

2152-
pub fn type_to_str(&self, ty: Type) -> ~str {
2152+
// We have a depth count, because we seem to make infinite types.
2153+
pub fn type_to_str_depth(&self, ty: Type, depth: int) -> ~str {
21532154
match self.find_name(&ty) {
21542155
option::Some(name) => return name.to_owned(),
21552156
None => ()
21562157
}
21572158

2159+
if depth == 0 {
2160+
return ~"###";
2161+
}
2162+
21582163
unsafe {
21592164
let kind = ty.kind();
21602165

@@ -2176,31 +2181,36 @@ impl TypeNames {
21762181
Function => {
21772182
let out_ty = ty.return_type();
21782183
let args = ty.func_params();
2179-
let args = args.map(|&ty| self.type_to_str(ty)).connect(", ");
2180-
let out_ty = self.type_to_str(out_ty);
2184+
let args =
2185+
args.map(|&ty| self.type_to_str_depth(ty, depth-1)).connect(", ");
2186+
let out_ty = self.type_to_str_depth(out_ty, depth-1);
21812187
fmt!("fn(%s) -> %s", args, out_ty)
21822188
}
21832189
Struct => {
21842190
let tys = ty.field_types();
2185-
let tys = tys.map(|&ty| self.type_to_str(ty)).connect(", ");
2191+
let tys = tys.map(|&ty| self.type_to_str_depth(ty, depth-1)).connect(", ");
21862192
fmt!("{%s}", tys)
21872193
}
21882194
Array => {
21892195
let el_ty = ty.element_type();
2190-
let el_ty = self.type_to_str(el_ty);
2196+
let el_ty = self.type_to_str_depth(el_ty, depth-1);
21912197
let len = ty.array_length();
21922198
fmt!("[%s x %u]", el_ty, len)
21932199
}
21942200
Pointer => {
21952201
let el_ty = ty.element_type();
2196-
let el_ty = self.type_to_str(el_ty);
2202+
let el_ty = self.type_to_str_depth(el_ty, depth-1);
21972203
fmt!("*%s", el_ty)
21982204
}
21992205
_ => fail!("Unknown Type Kind (%u)", kind as uint)
22002206
}
22012207
}
22022208
}
22032209

2210+
pub fn type_to_str(&self, ty: Type) -> ~str {
2211+
self.type_to_str_depth(ty, 30)
2212+
}
2213+
22042214
pub fn val_to_str(&self, val: ValueRef) -> ~str {
22052215
unsafe {
22062216
let ty = Type::from_ref(llvm::LLVMTypeOf(val));

0 commit comments

Comments
 (0)