From 3c119443767553d31c4c028a7c5519750897fc0a Mon Sep 17 00:00:00 2001 From: Ferdia McKeogh Date: Tue, 16 Jul 2019 07:51:13 +0200 Subject: [PATCH] Suggested change --- src/librustc/traits/specialize/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 9027d330a90f6..8a84fca143809 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -367,10 +367,11 @@ pub(super) fn specialization_graph_provider( } let access_levels = tcx.privacy_access_levels(impl_def_id.krate); - let id = tcx.hir().as_local_hir_id(impl_def_id).unwrap(); - if access_levels.is_exported(id) || access_levels.is_public(id) { - for cause in &overlap.intercrate_ambiguity_causes { - cause.add_intercrate_ambiguity_hint(&mut err); + if let Some(id) = tcx.hir().as_local_hir_id(impl_def_id) { + if access_levels.is_exported(id) || access_levels.is_public(id) { + for cause in &overlap.intercrate_ambiguity_causes { + cause.add_intercrate_ambiguity_hint(&mut err); + } } }