1
Fork 0

Don't document impossible to call default trait items on impls

This commit is contained in:
Michael Goulet 2022-08-07 05:47:32 +00:00
parent d77da9da84
commit b3b23aada9
4 changed files with 114 additions and 1 deletions

View file

@ -1550,6 +1550,15 @@ fn render_impl(
rendering_params: ImplRenderingParameters,
) {
for trait_item in &t.items {
// Skip over any default trait items that are impossible to call
// (e.g. if it has a `Self: Sized` bound on an unsized type).
if let Some(impl_def_id) = parent.item_id.as_def_id()
&& let Some(trait_item_def_id) = trait_item.item_id.as_def_id()
&& cx.tcx().is_impossible_method((impl_def_id, trait_item_def_id))
{
continue;
}
let n = trait_item.name;
if i.items.iter().any(|m| m.name == n) {
continue;