Skip to content

Commit eae2026

Browse files
committed
Set visibility to inherited in trait impls to match HIR
1 parent 1c82e5e commit eae2026

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,16 @@ impl Clean<Item> for ty::AssocItem {
12041204
}
12051205
};
12061206

1207-
Item::from_def_id_and_parts(self.def_id, Some(self.name), kind, cx)
1207+
let mut output = Item::from_def_id_and_parts(self.def_id, Some(self.name), kind, cx);
1208+
1209+
// HACK: Override visibility for items in a trait implementation to match HIR
1210+
let impl_ref = tcx.parent(self.def_id).and_then(|did| tcx.impl_trait_ref(did));
1211+
1212+
if impl_ref.is_some() {
1213+
output.visibility = Visibility::Inherited;
1214+
}
1215+
1216+
output
12081217
}
12091218
}
12101219

0 commit comments

Comments
 (0)