Skip to content

Commit 060566f

Browse files
committed
Fix RustDoc bug
1 parent 2474d7d commit 060566f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/librustdoc/clean/inline.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ fn try_inline_def(cx: &DocContext, tcx: &ty::ctxt,
7373
record_extern_fqn(cx, did, clean::TypeTrait);
7474
clean::TraitItem(build_external_trait(cx, tcx, did))
7575
}
76-
def::DefFn(did, style, false) => {
76+
def::DefFn(did, false) => {
7777
// If this function is a tuple struct constructor, we just skip it
7878
record_extern_fqn(cx, did, clean::TypeFunction);
79-
clean::FunctionItem(build_external_function(cx, tcx, did, style))
79+
clean::FunctionItem(build_external_function(cx, tcx, did))
8080
}
8181
def::DefStruct(did) => {
8282
record_extern_fqn(cx, did, clean::TypeStruct);
@@ -167,15 +167,14 @@ pub fn build_external_trait(cx: &DocContext, tcx: &ty::ctxt,
167167
}
168168
}
169169

170-
fn build_external_function(cx: &DocContext, tcx: &ty::ctxt,
171-
did: ast::DefId,
172-
style: ast::FnStyle) -> clean::Function {
170+
fn build_external_function(cx: &DocContext, tcx: &ty::ctxt, did: ast::DefId) -> clean::Function {
173171
let t = ty::lookup_item_type(tcx, did);
172+
let (decl, style) = match ty::get(t.ty).sty {
173+
ty::ty_bare_fn(ref f) => ((did, &f.sig).clean(cx), f.fn_style),
174+
_ => panic!("bad function"),
175+
};
174176
clean::Function {
175-
decl: match ty::get(t.ty).sty {
176-
ty::ty_bare_fn(ref f) => (did, &f.sig).clean(cx),
177-
_ => panic!("bad function"),
178-
},
177+
decl: decl,
179178
generics: (&t.generics, subst::FnSpace).clean(cx),
180179
fn_style: style,
181180
}

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,7 @@ fn resolve_type(cx: &DocContext, path: Path,
21242124

21252125
fn register_def(cx: &DocContext, def: def::Def) -> ast::DefId {
21262126
let (did, kind) = match def {
2127-
def::DefFn(i, _, _) => (i, TypeFunction),
2127+
def::DefFn(i, _) => (i, TypeFunction),
21282128
def::DefTy(i, false) => (i, TypeTypedef),
21292129
def::DefTy(i, true) => (i, TypeEnum),
21302130
def::DefTrait(i) => (i, TypeTrait),

0 commit comments

Comments
 (0)