Skip to content

Commit 9f7e62e

Browse files
committed
rustc: Fix a missing application of the operator in fold_ty
1 parent fa3aa64 commit 9f7e62e

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/rustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ fn fold_sty(sty: sty, fldop: fn(t) -> t) -> sty {
863863

864864
// Folds types from the bottom up.
865865
fn fold_ty(cx: ctxt, t0: t, fldop: fn(t) -> t) -> t {
866-
let sty = fold_sty(get(t0).struct) {|t| fold_ty(cx, t, fldop) };
866+
let sty = fold_sty(get(t0).struct) {|t| fold_ty(cx, fldop(t), fldop) };
867867
fldop(mk_t(cx, sty))
868868
}
869869

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Regression test that rustc doesn't recurse infinitely substituting
2+
// the boxed type parameter
3+
4+
type Tree<T> = {
5+
mut parent: option<T>,
6+
};
7+
8+
fn empty<T>() -> Tree<T> { fail }
9+
10+
class Box {
11+
let tree: Tree<@Box>;
12+
13+
new() {
14+
self.tree = empty();
15+
}
16+
}
17+
18+
enum layout_data = {
19+
mut box: option<@Box>
20+
};
21+
22+
fn main() { }

0 commit comments

Comments
 (0)