diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index ec44d765a8e68..bf63392c29f87 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -61,8 +61,10 @@ pub fn closure_analyze_fn(fcx: &FnCtxt, let mut seed = SeedBorrowKind::new(fcx); seed.visit_block(body); - let mut adjust = AdjustBorrowKind::new(fcx); - adjust.analyze_fn(decl, body); + if fcx.err_count_since_creation() == 0 { + let mut adjust = AdjustBorrowKind::new(fcx); + adjust.analyze_fn(decl, body); + } } /////////////////////////////////////////////////////////////////////////// diff --git a/src/test/compile-fail/unexpected-callee-type-ice.rs b/src/test/compile-fail/unexpected-callee-type-ice.rs new file mode 100644 index 0000000000000..a481852f2d092 --- /dev/null +++ b/src/test/compile-fail/unexpected-callee-type-ice.rs @@ -0,0 +1,15 @@ +// Copyright 2015 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. + +// Related issues: #20714, #20842, #20862 + +fn main() { + let homura = ""(); //~ ERROR expected function, found +}