Skip to content

Commit 2f7b7d5

Browse files
committed
Don't use is_local to determine function cleaning method call intent
1 parent 6abb638 commit 2f7b7d5

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ fn build_external_function(cx: &mut DocContext<'_>, did: DefId) -> clean::Functi
228228
let (generics, decl) = clean::enter_impl_trait(cx, |cx| {
229229
// NOTE: generics need to be cleaned before the decl!
230230
let generics = clean_ty_generics(cx, cx.tcx.generics_of(did), predicates);
231-
let decl = clean_fn_decl_from_did_and_sig(cx, did, sig);
231+
let decl = clean_fn_decl_from_did_and_sig(cx, Some(did), sig);
232232
(generics, decl)
233233
});
234234
clean::Function {

src/librustdoc/clean/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,10 @@ fn clean_fn_decl_with_args(
890890

891891
fn clean_fn_decl_from_did_and_sig(
892892
cx: &mut DocContext<'_>,
893-
did: DefId,
893+
did: Option<DefId>,
894894
sig: ty::PolyFnSig<'_>,
895895
) -> FnDecl {
896-
let mut names = if did.is_local() { &[] } else { cx.tcx.fn_arg_names(did) }.iter();
896+
let mut names = did.map_or(&[] as &[_], |did| cx.tcx.fn_arg_names(did)).iter();
897897

898898
FnDecl {
899899
output: Return(sig.skip_binder().output().clean(cx)),
@@ -1067,7 +1067,7 @@ impl Clean<Item> for ty::AssocItem {
10671067
tcx.explicit_predicates_of(self.def_id),
10681068
);
10691069
let sig = tcx.fn_sig(self.def_id);
1070-
let mut decl = clean_fn_decl_from_did_and_sig(cx, self.def_id, sig);
1070+
let mut decl = clean_fn_decl_from_did_and_sig(cx, Some(self.def_id), sig);
10711071

10721072
if self.fn_has_self_parameter {
10731073
let self_ty = match self.container {
@@ -1466,8 +1466,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14661466
ty::FnDef(..) | ty::FnPtr(_) => {
14671467
let ty = cx.tcx.lift(*self).expect("FnPtr lift failed");
14681468
let sig = ty.fn_sig(cx.tcx);
1469-
let def_id = DefId::local(CRATE_DEF_INDEX);
1470-
let decl = clean_fn_decl_from_did_and_sig(cx, def_id, sig);
1469+
let decl = clean_fn_decl_from_did_and_sig(cx, None, sig);
14711470
BareFunction(box BareFunctionDecl {
14721471
unsafety: sig.unsafety(),
14731472
generic_params: Vec::new(),

0 commit comments

Comments
 (0)