Skip to content

Commit 878f059

Browse files
committed
---
yaml --- r: 7875 b: refs/heads/snap-stage3 c: e48bf6f h: refs/heads/master i: 7873: cc6ba32 7871: 6e0c5e7 v: v3
1 parent b27b9c4 commit 878f059

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 362625008ab9e3479f7e34212e1887a3ad6d93b8
4+
refs/heads/snap-stage3: e48bf6f3f4d1ca07f0c2820c6cfaad275bc106ac
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/comp/middle/ty.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,8 @@ mod unify {
24212421
fn fixup_vars(tcx: ty_ctxt, sp: option::t<span>, vb: @var_bindings,
24222422
typ: t) -> fixup_result {
24232423
fn subst_vars(tcx: ty_ctxt, sp: option::t<span>, vb: @var_bindings,
2424-
unresolved: @mutable option::t<int>, vid: int) -> t {
2424+
unresolved: @mutable option::t<int>,
2425+
vars_seen: std::list::list<int>, vid: int) -> t {
24252426
// Should really return a fixup_result instead of a t, but fold_ty
24262427
// doesn't allow returning anything but a t.
24272428
if vid as uint >= ufind::set_count(vb.sets) {
@@ -2432,21 +2433,28 @@ mod unify {
24322433
alt smallintmap::find::<t>(vb.types, root_id) {
24332434
none { *unresolved = some(vid); ret ty::mk_var(tcx, vid); }
24342435
some(rt) {
2435-
if occurs_check_fails(tcx, sp, vid, rt) {
2436-
// Return the type unchanged, so we can error out
2437-
// downstream
2438-
ret rt;
2436+
let give_up = false;
2437+
std::list::iter(vars_seen) {|v|
2438+
if v == vid {
2439+
give_up = true;
2440+
option::may(sp) {|sp|
2441+
tcx.sess.span_fatal(
2442+
sp, "can not instantiate infinite type");
2443+
}
2444+
}
24392445
}
2440-
ret fold_ty(tcx,
2441-
fm_var(bind subst_vars(tcx, sp, vb, unresolved,
2442-
_)), rt);
2446+
// Return the type unchanged, so we can error out
2447+
// downstream
2448+
if give_up { ret rt; }
2449+
ret fold_ty(tcx, fm_var(bind subst_vars(
2450+
tcx, sp, vb, unresolved, std::list::cons(vid, @vars_seen),
2451+
_)), rt);
24432452
}
24442453
}
24452454
}
24462455
let unresolved = @mutable none::<int>;
2447-
let rty =
2448-
fold_ty(tcx, fm_var(bind subst_vars(tcx, sp, vb, unresolved, _)),
2449-
typ);
2456+
let rty = fold_ty(tcx, fm_var(bind subst_vars(
2457+
tcx, sp, vb, unresolved, std::list::nil, _)), typ);
24502458
let ur = *unresolved;
24512459
alt ur {
24522460
none { ret fix_ok(rty); }

branches/snap-stage3/src/libstd/list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Function: tail
128128
129129
Returns all but the first element of a list
130130
*/
131-
pure fn tail<T: copy>(ls: list<T>) : is_not_empty(ls) -> list<T> {
131+
pure fn tail<T: copy>(ls: list<T>) -> list<T> {
132132
alt ls {
133133
cons(_, tl) { ret *tl; }
134134
nil { fail "list empty" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
// error-pattern: Type inference failed because I could not find
1+
// error-pattern: can not instantiate infinite type
22
fn main() { let f; f = @f; }

0 commit comments

Comments
 (0)