Skip to content

Commit 8373422

Browse files
committed
Make fewer typechecker errors immediately fatal.
1 parent 70b0091 commit 8373422

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/comp/middle/typeck.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,9 @@ mod collect {
598598
if ty::type_has_dynamic_size(cx.tcx, tt) {
599599
alt ty_mode {
600600
mo_val. {
601-
cx.tcx.sess.span_fatal(a.ty.span,
602-
"Dynamically sized arguments \
603-
must be passed by alias");
601+
cx.tcx.sess.span_err(a.ty.span,
602+
"Dynamically sized arguments \
603+
must be passed by alias");
604604
}
605605
_ { }
606606
}
@@ -1776,7 +1776,7 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
17761776
let errmsg =
17771777
"binary operation " + binopstr +
17781778
" cannot be applied to type `" + t_str + "`";
1779-
fcx.ccx.tcx.sess.span_fatal(span, errmsg);
1779+
fcx.ccx.tcx.sess.span_err(span, errmsg);
17801780
}
17811781
}
17821782

@@ -1845,18 +1845,18 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
18451845
ast::not. {
18461846
if !type_is_integral(fcx, oper.span, oper_t) &&
18471847
structure_of(fcx, oper.span, oper_t) != ty::ty_bool {
1848-
tcx.sess.span_fatal(expr.span,
1849-
#fmt("mismatched types: expected bool \
1850-
or integer but found %s",
1851-
ty_to_str(tcx, oper_t)));
1848+
tcx.sess.span_err(expr.span,
1849+
#fmt("mismatched types: expected bool \
1850+
or integer but found %s",
1851+
ty_to_str(tcx, oper_t)));
18521852
}
18531853
}
18541854
ast::neg. {
18551855
oper_t = structurally_resolved_type(fcx, oper.span, oper_t);
18561856
if !(ty::type_is_integral(tcx, oper_t) ||
18571857
ty::type_is_fp(tcx, oper_t)) {
1858-
tcx.sess.span_fatal(expr.span, "applying unary minus to \
1859-
non-numeric type " + ty_to_str(tcx, oper_t));
1858+
tcx.sess.span_err(expr.span, "applying unary minus to \
1859+
non-numeric type " + ty_to_str(tcx, oper_t));
18601860
}
18611861
}
18621862
}
@@ -1898,8 +1898,8 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
18981898
none. {
18991899
let nil = ty::mk_nil(tcx);
19001900
if !are_compatible(fcx, fcx.ret_ty, nil) {
1901-
tcx.sess.span_fatal(expr.span,
1902-
"ret; in function returning non-nil");
1901+
tcx.sess.span_err(expr.span,
1902+
"ret; in function returning non-nil");
19031903
}
19041904
}
19051905
some(e) {
@@ -1911,14 +1911,14 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
19111911
ast::expr_put(expr_opt) {
19121912
require_impure(tcx.sess, fcx.purity, expr.span);
19131913
if (fcx.proto != ast::proto_iter) {
1914-
tcx.sess.span_fatal(expr.span, "put in non-iterator");
1914+
tcx.sess.span_err(expr.span, "put in non-iterator");
19151915
}
19161916
alt expr_opt {
19171917
none. {
19181918
let nil = ty::mk_nil(tcx);
19191919
if !are_compatible(fcx, fcx.ret_ty, nil) {
1920-
tcx.sess.span_fatal(expr.span,
1921-
"put; in iterator yielding non-nil");
1920+
tcx.sess.span_err(expr.span,
1921+
"put; in iterator yielding non-nil");
19221922
}
19231923
}
19241924
some(e) {
@@ -2172,10 +2172,10 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
21722172

21732173
if !(type_is_scalar(fcx, expr.span, expr_ty(tcx, e)) &&
21742174
type_is_scalar(fcx, expr.span, t_1)) {
2175-
tcx.sess.span_fatal(expr.span,
2176-
"non-scalar cast: " +
2177-
ty_to_str(tcx, expr_ty(tcx, e))
2178-
+ " as " + ty_to_str(tcx, t_1));
2175+
tcx.sess.span_err(expr.span,
2176+
"non-scalar cast: " +
2177+
ty_to_str(tcx, expr_ty(tcx, e))
2178+
+ " as " + ty_to_str(tcx, t_1));
21792179
}
21802180
write::ty_only_fixup(fcx, id, t_1);
21812181
}
@@ -2293,10 +2293,10 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
22932293
bot |= check_expr(fcx, idx);
22942294
let idx_t = expr_ty(tcx, idx);
22952295
if !type_is_integral(fcx, idx.span, idx_t) {
2296-
tcx.sess.span_fatal(idx.span,
2297-
"mismatched types: expected \
2298-
integer but found "
2299-
+ ty_to_str(tcx, idx_t));
2296+
tcx.sess.span_err(idx.span,
2297+
"mismatched types: expected \
2298+
integer but found "
2299+
+ ty_to_str(tcx, idx_t));
23002300
}
23012301
alt structure_of(fcx, expr.span, base_t) {
23022302
ty::ty_vec(mt) { write::ty_only_fixup(fcx, id, mt.ty); }
@@ -2600,8 +2600,8 @@ fn check_fn(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
26002600
// This just checks that the declared type is bool, and trusts
26012601
// that that's the actual return type.
26022602
if !ty::type_is_bool(ccx.tcx, fcx.ret_ty) {
2603-
ccx.tcx.sess.span_fatal(body.span,
2604-
"Non-boolean return type in pred");
2603+
ccx.tcx.sess.span_err(body.span,
2604+
"Non-boolean return type in pred");
26052605
}
26062606
}
26072607
_ { }

0 commit comments

Comments
 (0)