From 19225eb400ff63dda0bf2f2b64b861b27eb1d2c1 Mon Sep 17 00:00:00 2001 From: David Renshaw Date: Sat, 13 May 2017 15:35:53 -0400 Subject: [PATCH] restore TyCtxt::push_impl_path() logic for checking whether types are available --- src/librustc/ty/item_path.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index 16d5d1187fc8b..996c561f4244d 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -221,7 +221,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let use_types = !impl_def_id.is_local() || { // Otherwise, use filename/line-number if forced. let force_no_types = FORCE_IMPL_FILENAME_LINE.with(|f| f.get()); - !force_no_types && { + + // Check whether type info is available, because typeck might not have + // completed yet. + let types_available = self.maps.impl_trait_ref.borrow().contains_key(&impl_def_id) && + self.maps.type_of.borrow().contains_key(&impl_def_id); + + !force_no_types && types_available && { // Otherwise, use types if we can query them without inducing a cycle. ty::queries::impl_trait_ref::try_get(self, DUMMY_SP, impl_def_id).is_ok() && ty::queries::type_of::try_get(self, DUMMY_SP, impl_def_id).is_ok()