Suppress error messages about function types whose result is ty_err

Ideally we would suppress error messages involving any types that
contain ty_err, but that's awkward to do right now.
This commit is contained in:
Tim Chevalier 2013-01-07 19:33:32 -08:00
parent b43e639bf6
commit 2d1ce01a8a

View file

@ -737,10 +737,19 @@ impl infer_ctxt {
fn type_error_message(sp: span, mk_msg: fn(~str) -> ~str,
actual_ty: ty::t, err: Option<&ty::type_err>) {
let actual_ty = self.resolve_type_vars_if_possible(actual_ty);
let mut actual_sty = ty::get(copy actual_ty);
// Don't report an error if actual type is ty_err.
match ty::get(actual_ty).sty {
match actual_sty.sty {
ty::ty_err => return,
// Should really not report an error if the type
// has ty_err anywhere as a component, but that's
// annoying since we haven't written a visitor for
// ty::t yet
ty::ty_fn(ref fty) => match ty::get(fty.sig.output).sty {
ty::ty_err => return,
_ => ()
},
_ => ()
}
let error_str = err.map_default(~"", |t_err|