diff options
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index a2e612955b3..4fe433188c9 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -228,7 +228,7 @@ fn build_external_function(cx: &mut DocContext<'_>, did: DefId) -> clean::Functi let (generics, decl) = clean::enter_impl_trait(cx, |cx| { // NOTE: generics need to be cleaned before the decl! let generics = clean_ty_generics(cx, cx.tcx.generics_of(did), predicates); - let decl = clean_fn_decl_from_did_and_sig(cx, did, sig); + let decl = clean_fn_decl_from_did_and_sig(cx, Some(did), sig); (generics, decl) }); clean::Function { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 33612c80654..f9b4d1435bd 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -890,10 +890,10 @@ fn clean_fn_decl_with_args( fn clean_fn_decl_from_did_and_sig( cx: &mut DocContext<'_>, - did: DefId, + did: Option<DefId>, sig: ty::PolyFnSig<'_>, ) -> FnDecl { - let mut names = if did.is_local() { &[] } else { cx.tcx.fn_arg_names(did) }.iter(); + let mut names = did.map_or(&[] as &[_], |did| cx.tcx.fn_arg_names(did)).iter(); FnDecl { output: Return(sig.skip_binder().output().clean(cx)), @@ -1067,7 +1067,7 @@ impl Clean<Item> for ty::AssocItem { tcx.explicit_predicates_of(self.def_id), ); let sig = tcx.fn_sig(self.def_id); - let mut decl = clean_fn_decl_from_did_and_sig(cx, self.def_id, sig); + let mut decl = clean_fn_decl_from_did_and_sig(cx, Some(self.def_id), sig); if self.fn_has_self_parameter { let self_ty = match self.container { @@ -1466,8 +1466,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> { ty::FnDef(..) | ty::FnPtr(_) => { let ty = cx.tcx.lift(*self).expect("FnPtr lift failed"); let sig = ty.fn_sig(cx.tcx); - let def_id = DefId::local(CRATE_DEF_INDEX); - let decl = clean_fn_decl_from_did_and_sig(cx, def_id, sig); + let decl = clean_fn_decl_from_did_and_sig(cx, None, sig); BareFunction(box BareFunctionDecl { unsafety: sig.unsafety(), generic_params: Vec::new(), |
