From 2d1ce01a8a8ef491d0490b5627c9b21076c03c10 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 7 Jan 2013 19:33:32 -0800 Subject: [PATCH] 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. --- src/librustc/middle/typeck/infer/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 279318079b9a..ccd0066de28c 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -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|