Skip to content

Commit a4d88da

Browse files
committed
rustc: Fail to unify if two ty_vars don't unify
Closes #500
1 parent 2a69db5 commit a4d88da

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/comp/middle/ty.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,12 @@ mod unify {
19431943
alt (struct(cx.tcx, expected)) {
19441944
case (ty::ty_var(?expected_id)) {
19451945
auto expected_n = expected_id as uint;
1946-
union(cx, expected_n, actual_n);
1946+
alt(union(cx, expected_n, actual_n)) {
1947+
case (unres_ok) { /* fall through */ }
1948+
case (unres_err(?t_e)) {
1949+
ret ures_err(t_e);
1950+
}
1951+
}
19471952
}
19481953
case (_) {
19491954

src/test/compile-fail/binop-typeck.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// xfail-stage0
2+
// error-pattern:mismatched types
3+
// issue #500
4+
5+
fn main() {
6+
auto x = true;
7+
auto y = 1;
8+
auto z = x + y;
9+
}

0 commit comments

Comments
 (0)