Add type to differentiate between fake and real DefId's

This commit is contained in:
Justus K 2021-04-29 21:36:54 +02:00
parent 7a0f1781d0
commit b6120bfb35
No known key found for this signature in database
GPG key ID: 8C62FE98A62FC462
28 changed files with 336 additions and 268 deletions

View file

@ -464,6 +464,8 @@ pub(super) fn write_shared(
// Update the list of all implementors for traits
let dst = cx.dst.join("implementors");
for (&did, imps) in &cx.cache.implementors {
let did = did.expect_real();
// Private modules can leak through to this phase of rustdoc, which
// could contain implementations for otherwise private types. In some
// rare cases we could find an implementation for an item which wasn't
@ -496,7 +498,7 @@ pub(super) fn write_shared(
//
// If the implementation is from another crate then that crate
// should add it.
if imp.impl_item.def_id.krate == did.krate || !imp.impl_item.def_id.is_local() {
if imp.impl_item.def_id.krate() == did.krate || !imp.impl_item.def_id.is_local() {
None
} else {
Some(Implementor {