Skip to content

Commit

Permalink
Fix RustDoc bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Oct 31, 2014
1 parent 2474d7d commit 060566f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions src/librustdoc/clean/inline.rs
Expand Up @@ -73,10 +73,10 @@ fn try_inline_def(cx: &DocContext, tcx: &ty::ctxt,
record_extern_fqn(cx, did, clean::TypeTrait);
clean::TraitItem(build_external_trait(cx, tcx, did))
}
def::DefFn(did, style, false) => {
def::DefFn(did, false) => {
// If this function is a tuple struct constructor, we just skip it
record_extern_fqn(cx, did, clean::TypeFunction);
clean::FunctionItem(build_external_function(cx, tcx, did, style))
clean::FunctionItem(build_external_function(cx, tcx, did))
}
def::DefStruct(did) => {
record_extern_fqn(cx, did, clean::TypeStruct);
Expand Down Expand Up @@ -167,15 +167,14 @@ pub fn build_external_trait(cx: &DocContext, tcx: &ty::ctxt,
}
}

fn build_external_function(cx: &DocContext, tcx: &ty::ctxt,
did: ast::DefId,
style: ast::FnStyle) -> clean::Function {
fn build_external_function(cx: &DocContext, tcx: &ty::ctxt, did: ast::DefId) -> clean::Function {
let t = ty::lookup_item_type(tcx, did);
let (decl, style) = match ty::get(t.ty).sty {
ty::ty_bare_fn(ref f) => ((did, &f.sig).clean(cx), f.fn_style),
_ => panic!("bad function"),
};
clean::Function {
decl: match ty::get(t.ty).sty {
ty::ty_bare_fn(ref f) => (did, &f.sig).clean(cx),
_ => panic!("bad function"),
},
decl: decl,
generics: (&t.generics, subst::FnSpace).clean(cx),
fn_style: style,
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/clean/mod.rs
Expand Up @@ -2124,7 +2124,7 @@ fn resolve_type(cx: &DocContext, path: Path,

fn register_def(cx: &DocContext, def: def::Def) -> ast::DefId {
let (did, kind) = match def {
def::DefFn(i, _, _) => (i, TypeFunction),
def::DefFn(i, _) => (i, TypeFunction),
def::DefTy(i, false) => (i, TypeTypedef),
def::DefTy(i, true) => (i, TypeEnum),
def::DefTrait(i) => (i, TypeTrait),
Expand Down

5 comments on commit 060566f

@bors
Copy link
Contributor

@bors bors commented on 060566f Oct 31, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from nikomatsakis
at nrc@060566f

@bors
Copy link
Contributor

@bors bors commented on 060566f Oct 31, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging nick29581/rust/ufcs2 = 060566f into auto

@bors
Copy link
Contributor

@bors bors commented on 060566f Oct 31, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nick29581/rust/ufcs2 = 060566f merged ok, testing candidate = 88b6e93

@bors
Copy link
Contributor

@bors bors commented on 060566f Nov 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 060566f Nov 1, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 88b6e93

Please sign in to comment.