diff options
| author | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-11-02 15:23:25 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <liehr.exchange@gmx.net> | 2022-11-04 20:10:51 +0100 |
| commit | 71561f82c3e40a86bce330c8fa32aede3958e53d (patch) | |
| tree | df1aec5b3155a865d5067bfe39100d6c28d722fb /src | |
| parent | 1ac703448186773dbaa30382ed2423473a2f6bc2 (diff) | |
| download | rust-71561f82c3e40a86bce330c8fa32aede3958e53d.tar.gz rust-71561f82c3e40a86bce330c8fa32aede3958e53d.zip | |
rustdoc: render the return type of cross-crate `Fn`-family trait bounds in trait-object types
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/utils.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index df20dc3fc3f..824d98113c8 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -4,7 +4,7 @@ use crate::clean::render_macro_matchers::render_macro_matcher; use crate::clean::{ clean_doc_module, clean_middle_const, clean_middle_region, clean_middle_ty, inline, Crate, ExternalCrate, Generic, GenericArg, GenericArgs, ImportSource, Item, ItemKind, Lifetime, Path, - PathSegment, Primitive, PrimitiveType, Type, TypeBinding, + PathSegment, Primitive, PrimitiveType, Term, Type, TypeBinding, TypeBindingKind, }; use crate::core::DocContext; use crate::html::format::visibility_to_src_with_space; @@ -113,12 +113,12 @@ fn external_generic_args<'tcx>( ty::Tuple(tys) => tys.iter().map(|t| clean_middle_ty(t, cx, None)).collect::<Vec<_>>().into(), _ => return GenericArgs::AngleBracketed { args: args.into(), bindings }, }; - let output = None; - // FIXME(#20299) return type comes from a projection now - // match types[1].kind { - // ty::Tuple(ref v) if v.is_empty() => None, // -> () - // _ => Some(types[1].clean(cx)) - // }; + let output = bindings.into_iter().next().and_then(|binding| match binding.kind { + TypeBindingKind::Equality { term: Term::Type(ty) } if ty != Type::Tuple(Vec::new()) => { + Some(Box::new(ty)) + } + _ => None, + }); GenericArgs::Parenthesized { inputs, output } } else { GenericArgs::AngleBracketed { args: args.into(), bindings: bindings.into() } |
