Skip to content

Commit 71561f8

Browse files
committed
rustdoc: render the return type of cross-crate Fn-family trait bounds in trait-object types
1 parent 1ac7034 commit 71561f8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: src/librustdoc/clean/utils.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::clean::render_macro_matchers::render_macro_matcher;
44
use crate::clean::{
55
clean_doc_module, clean_middle_const, clean_middle_region, clean_middle_ty, inline, Crate,
66
ExternalCrate, Generic, GenericArg, GenericArgs, ImportSource, Item, ItemKind, Lifetime, Path,
7-
PathSegment, Primitive, PrimitiveType, Type, TypeBinding,
7+
PathSegment, Primitive, PrimitiveType, Term, Type, TypeBinding, TypeBindingKind,
88
};
99
use crate::core::DocContext;
1010
use crate::html::format::visibility_to_src_with_space;
@@ -113,12 +113,12 @@ fn external_generic_args<'tcx>(
113113
ty::Tuple(tys) => tys.iter().map(|t| clean_middle_ty(t, cx, None)).collect::<Vec<_>>().into(),
114114
_ => return GenericArgs::AngleBracketed { args: args.into(), bindings },
115115
};
116-
let output = None;
117-
// FIXME(#20299) return type comes from a projection now
118-
// match types[1].kind {
119-
// ty::Tuple(ref v) if v.is_empty() => None, // -> ()
120-
// _ => Some(types[1].clean(cx))
121-
// };
116+
let output = bindings.into_iter().next().and_then(|binding| match binding.kind {
117+
TypeBindingKind::Equality { term: Term::Type(ty) } if ty != Type::Tuple(Vec::new()) => {
118+
Some(Box::new(ty))
119+
}
120+
_ => None,
121+
});
122122
GenericArgs::Parenthesized { inputs, output }
123123
} else {
124124
GenericArgs::AngleBracketed { args: args.into(), bindings: bindings.into() }

0 commit comments

Comments
 (0)