From 60ab57e56d0bbadb8b2643a03c6d8799048e8342 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 16 Oct 2015 20:18:37 -0400 Subject: [PATCH] do not dump extern def-ids with path for now --- src/librustc/middle/def_id.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/librustc/middle/def_id.rs b/src/librustc/middle/def_id.rs index ba4eac9e9eb..288eb01ebb4 100644 --- a/src/librustc/middle/def_id.rs +++ b/src/librustc/middle/def_id.rs @@ -61,12 +61,16 @@ impl fmt::Debug for DefId { // Unfortunately, there seems to be no way to attempt to print // a path for a def-id, so I'll just make a best effort for now // and otherwise fallback to just printing the crate/node pair - try!(ty::tls::with_opt(|opt_tcx| { - if let Some(tcx) = opt_tcx { - try!(write!(f, " => {}", tcx.item_path_str(*self))); - } - Ok(()) - })); + if self.is_local() { // (1) + // (1) side-step fact that not all external things have paths at + // the moment, such as type parameters + try!(ty::tls::with_opt(|opt_tcx| { + if let Some(tcx) = opt_tcx { + try!(write!(f, " => {}", tcx.item_path_str(*self))); + } + Ok(()) + })); + } write!(f, " }}") }