From d87644cc0fb71cdfffc1619df25243d3f7640613 Mon Sep 17 00:00:00 2001 From: Andrew Cann Date: Fri, 3 Feb 2017 21:12:03 +0800 Subject: Small inference fix As per comment: https://github.com/rust-lang/rust/issues/39297#issuecomment-276810343 --- src/librustc_typeck/check/mod.rs | 11 ----------- src/test/compile-fail/issue-10176.rs | 19 ------------------- src/test/compile-fail/issue-5500.rs | 17 ----------------- 3 files changed, 47 deletions(-) delete mode 100644 src/test/compile-fail/issue-10176.rs delete mode 100644 src/test/compile-fail/issue-5500.rs (limited to 'src') diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 8329d3eeed9..3ac0c9f0424 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4156,17 +4156,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; if self.diverges.get().always() { - if let ExpectHasType(ety) = expected { - // Avoid forcing a type (only `!` for now) in unreachable code. - // FIXME(aburka) do we need this special case? and should it be is_uninhabited? - if !ety.is_never() { - if let Some(ref e) = blk.expr { - // Coerce the tail expression to the right type. - self.demand_coerce(e, ty, ety); - } - } - } - ty = self.next_diverging_ty_var(TypeVariableOrigin::DivergingBlockExpr(blk.span)); } else if let ExpectHasType(ety) = expected { if let Some(ref e) = blk.expr { diff --git a/src/test/compile-fail/issue-10176.rs b/src/test/compile-fail/issue-10176.rs deleted file mode 100644 index 434b795ff31..00000000000 --- a/src/test/compile-fail/issue-10176.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 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 f() -> isize { - (return 1, return 2) -//~^ ERROR mismatched types -//~| expected type `isize` -//~| found type `(_, _)` -//~| expected isize, found tuple -} - -fn main() {} diff --git a/src/test/compile-fail/issue-5500.rs b/src/test/compile-fail/issue-5500.rs deleted file mode 100644 index 1cbb7588e17..00000000000 --- a/src/test/compile-fail/issue-5500.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 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() { - &panic!() - //~^ ERROR mismatched types - //~| expected type `()` - //~| found type `&_` - //~| expected (), found reference -} -- cgit 1.4.1-3-g733a5