From dee5024227b069ca787ae0f606a628bcfa94f90b Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Sun, 22 Feb 2015 16:18:32 +0100 Subject: [PATCH] Avoid ICE when `FnCtxt::local_ty` cannot find type; issue error then, return `ty_err`. --- src/librustc_typeck/check/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index fd6ba79ec21..cd72fd85cb7 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1363,10 +1363,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { match self.inh.locals.borrow().get(&nid) { Some(&t) => t, None => { - self.tcx().sess.span_bug( + self.tcx().sess.span_err( span, - &format!("no type for local variable {}", - nid)); + &format!("no type for local variable {}", nid)); + self.tcx().types.err } } }