Skip to content

Commit 2d1ce01

Browse files
committed
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.
1 parent b43e639 commit 2d1ce01

File tree

1 file changed

+10
-1
lines changed
  • src/librustc/middle/typeck/infer

1 file changed

+10
-1
lines changed

src/librustc/middle/typeck/infer/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,10 +737,19 @@ impl infer_ctxt {
737737
fn type_error_message(sp: span, mk_msg: fn(~str) -> ~str,
738738
actual_ty: ty::t, err: Option<&ty::type_err>) {
739739
let actual_ty = self.resolve_type_vars_if_possible(actual_ty);
740+
let mut actual_sty = ty::get(copy actual_ty);
740741

741742
// Don't report an error if actual type is ty_err.
742-
match ty::get(actual_ty).sty {
743+
match actual_sty.sty {
743744
ty::ty_err => return,
745+
// Should really not report an error if the type
746+
// has ty_err anywhere as a component, but that's
747+
// annoying since we haven't written a visitor for
748+
// ty::t yet
749+
ty::ty_fn(ref fty) => match ty::get(fty.sig.output).sty {
750+
ty::ty_err => return,
751+
_ => ()
752+
},
744753
_ => ()
745754
}
746755
let error_str = err.map_default(~"", |t_err|

0 commit comments

Comments
 (0)