Use span_err instead of err. Fixes issue #444.

This commit is contained in:
Lindsey Kuper 2011-06-01 17:15:02 -07:00
parent d569a71b0b
commit 528c6516f0
2 changed files with 16 additions and 3 deletions

View File

@ -2009,9 +2009,8 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
case (none) {
auto nil = ty::mk_nil(scx.fcx.ccx.tcx);
if (!are_compatible(scx, scx.fcx.ret_ty, nil)) {
// TODO: span_err
scx.fcx.ccx.tcx.sess.err("ret; in function " +
"returning non-nil");
scx.fcx.ccx.tcx.sess.span_err(expr.span,
"ret; in function returning non-nil");
}
write::bot_ty(scx.fcx.ccx.tcx, a.id);

View File

@ -0,0 +1,14 @@
// error-pattern: ret; in function returning non-nil
fn f() {
ret;
}
fn g() -> int {
ret;
}
fn main() {
f();
g();
}