rustc: Make return value checking warnings a little prettier. Also introduce a new "note" diagnostic level.

This commit is contained in:
Patrick Walton 2011-05-17 14:12:49 -07:00
parent 5047ab0b0c
commit f300de2963
2 changed files with 10 additions and 3 deletions

View file

@ -141,9 +141,11 @@ fn check_states_against_conditions(&fn_ctxt fcx, &_fn f, &ann a) -> () {
/* fcx.ccx.tcx.sess.span_err(f.body.span, "Function " +
fcx.name + " may not return. Its declared return type is "
+ util.common.ty_to_str(*f.decl.output)); */
log_err("WARNING: Function " +
fcx.name + " may not return. Its declared return type is "
+ ty_to_str(*f.decl.output));
fcx.ccx.tcx.sess.span_warn(f.body.span, "not all control paths " +
"return a value");
fcx.ccx.tcx.sess.span_note(f.decl.output.span,
"see declared return type of '" + ty_to_str(*f.decl.output) +
"'");
}
}