From 22c65f924266ba738fa3621ea07d31bc7ba8c45f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 5 Dec 2019 09:21:52 -0800 Subject: [PATCH] Do not ICE on closure typeck Tackle #66868. --- src/librustc/traits/error_reporting.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index ba44c6c3b9a1f..b644175a309c9 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -2214,6 +2214,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } let span = self.tcx.def_span(generator_did); + // Do not ICE on closure typeck (#66868). + if let None = self.tcx.hir().as_local_hir_id(generator_did) { + return false; + } let tables = self.tcx.typeck_tables_of(generator_did); debug!("note_obligation_cause_for_async_await: generator_did={:?} span={:?} ", generator_did, span);