diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index a46ee330a8579..e6d54879181db 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -942,15 +942,7 @@ impl FnCtxt { if ty::type_is_error(e) || ty::type_is_error(a) { return; } - match self.fn_kind { - DoBlock if ty::type_is_bool(e) && ty::type_is_nil(a) => - // If we expected bool and got ()... - self.tcx().sess.span_err(sp, fmt!("Do-block body must \ - return %s, but returns () here. Perhaps you meant \ - to write a `for`-loop?", - ppaux::ty_to_str(self.tcx(), e))), - _ => self.infcx().report_mismatched_types(sp, e, a, err) - } + self.infcx().report_mismatched_types(sp, e, a, err) } pub fn report_mismatched_types(&self, diff --git a/src/test/compile-fail/issue-2817.rs b/src/test/compile-fail/issue-2817.rs deleted file mode 100644 index 384b2cc843b0e..0000000000000 --- a/src/test/compile-fail/issue-2817.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::uint; - -fn uuid() -> uint { fail!(); } - -fn from_str(s: ~str) -> uint { fail!(); } -fn to_str(u: uint) -> ~str { fail!(); } -fn uuid_random() -> uint { fail!(); } - -fn main() { - do range(0u, 100000).advance |_i| { //~ ERROR Do-block body must return bool, but - }; - // should get a more general message if the callback - // doesn't return nil - do range(0u, 100000).advance |_i| { //~ ERROR mismatched types - ~"str" - }; -} diff --git a/src/test/compile-fail/issue-3651-2.rs b/src/test/compile-fail/issue-3651-2.rs deleted file mode 100644 index bcd8e86d1d3bb..0000000000000 --- a/src/test/compile-fail/issue-3651-2.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - fn take_block(f: &fn() -> bool) -> bool { f() } - do take_block {}; //~ ERROR Do-block body must return bool, but returns () here. Perhaps -}