Skip to content

Commit 60ab57e

Browse files
committed
do not dump extern def-ids with path for now
1 parent a1e2a55 commit 60ab57e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/librustc/middle/def_id.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ impl fmt::Debug for DefId {
6161
// Unfortunately, there seems to be no way to attempt to print
6262
// a path for a def-id, so I'll just make a best effort for now
6363
// and otherwise fallback to just printing the crate/node pair
64-
try!(ty::tls::with_opt(|opt_tcx| {
65-
if let Some(tcx) = opt_tcx {
66-
try!(write!(f, " => {}", tcx.item_path_str(*self)));
67-
}
68-
Ok(())
69-
}));
64+
if self.is_local() { // (1)
65+
// (1) side-step fact that not all external things have paths at
66+
// the moment, such as type parameters
67+
try!(ty::tls::with_opt(|opt_tcx| {
68+
if let Some(tcx) = opt_tcx {
69+
try!(write!(f, " => {}", tcx.item_path_str(*self)));
70+
}
71+
Ok(())
72+
}));
73+
}
7074

7175
write!(f, " }}")
7276
}

0 commit comments

Comments
 (0)