Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: Show all impls of traits. #5406 #5415

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/librustdoc/prune_private_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,19 @@ fn is_visible(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
do astsrv::exec(srv) |ctxt| {
match ctxt.ast_map.get(&id) {
ast_map::node_item(item, _) => {
item.vis == ast::public
match item.node {
ast::item_impl(_, Some(_), _, _) => {
// This is a trait implementation, make it visible
// NOTE: This is not quite right since this could be an impl
// of a private trait. We can't know that without running
// resolve though.
true
}
_ => {
// Otherwise just look at the visibility
item.vis == ast::public
}
}
}
_ => util::unreachable()
}
Expand All @@ -72,6 +84,16 @@ fn should_prune_items_without_pub_modifier() {
fail_unless!(vec::is_empty(doc.cratemod().mods()));
}

#[test]
fn unless_they_are_trait_impls() {
let doc = test::mk_doc(
~" \
trait Foo { } \
impl Foo for int { } \
");
fail_unless!(!doc.cratemod().impls().is_empty());
}

#[cfg(test)]
pub mod test {
use astsrv;
Expand Down