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 trait implementors in sidebar #91277

Conversation

aDotInTheVoid
Copy link
Member

@aDotInTheVoid aDotInTheVoid commented Nov 27, 2021

Fixes #91118

image

@rustbot: modify labels: +A-rustdoc +A-rustdoc-ui +T-rustdoc

r? @jyn514

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 27, 2021
@@ -73,7 +75,7 @@ crate struct Context<'tcx> {

// `Context` is cloned a lot, so we don't want the size to grow unexpectedly.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(Context<'_>, 144);
rustc_data_structures::static_assert_size!(Context<'_>, 184);
Copy link
Member Author

Choose a reason for hiding this comment

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

This increase seems to be fine, as when cloned, we create a new map, so perf is neutral (#91257)


// @has foo/trait.NotImpled.html
// @!has - '//*[@class="sidebar-title"]/a[@href="#implementors"]'
// FIXME: Is this the semantics we want
Copy link
Member Author

Choose a reason for hiding this comment

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

Specificly the page is documented like

image

Because we only write the "Implementations on Foreign Types" header when they are present (

if !foreign.is_empty() {
) wheras we don't for local impl (
write_small_section_header(
w,
"implementors",
"Implementors",
"<div class=\"item-list\" id=\"implementors-list\">",
);
for implementor in concrete {
render_implementor(cx, implementor, it, w, &implementor_dups, &[]);
}
)

If theirs a reason for this, its fine to keep, otherwize I'll change it to be consistant

Copy link
Member

Choose a reason for hiding this comment

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

It's because the implementors section also list implementations on foreign types (as you can see here for example).

@aDotInTheVoid aDotInTheVoid force-pushed the rustdoc-trait-impl-implementors-sidebar branch from 1bd2478 to 9f47199 Compare November 27, 2021 01:55
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoid aDotInTheVoid force-pushed the rustdoc-trait-impl-implementors-sidebar branch from 9f47199 to 3ff81db Compare November 27, 2021 02:23
@jyn514 jyn514 changed the title Rustdoc trait impl implementors sidebar rustdoc: show trait implementors in sidebar Nov 27, 2021
@jyn514
Copy link
Member

jyn514 commented Nov 27, 2021

@GuillaumeGomez do you mind taking over the review? not sure I have time for this

@@ -40,4 +40,8 @@ impl Impl {
crate fn trait_did(&self) -> Option<DefId> {
self.inner_impl().trait_.as_ref().map(|t| t.def_id())
}

crate fn is_local(&self, cache: &cache::Cache) -> bool {
self.inner_impl().for_.def_id(cache).map_or(true, |d| cache.paths.contains_key(&d))
Copy link
Member

Choose a reason for hiding this comment

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

This function name is not accurate (see #86798). What do you intend for the behavior to be?

@GuillaumeGomez
Copy link
Member

@GuillaumeGomez do you mind taking over the review? not sure I have time for this

Sure, won't have time today but I'll review in the next two days.

r? @GuillaumeGomez

@camelid camelid added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Nov 28, 2021
@camelid
Copy link
Member

camelid commented Nov 28, 2021

I kind of think we should just remove the implementors sidebar section; see #91118 (comment).

@GuillaumeGomez
Copy link
Member

I kind of think we should just remove the implementors sidebar section; see #91118 (comment).

Just for the record, I think the current one is fine.

There is a discussion going on zulip about this PR here. Don't hesitate to come by to give your opinion as well @aDotInTheVoid.

@camelid
Copy link
Member

camelid commented Nov 28, 2021

Just for the record, I think the current one is fine.

What do you mean by "the current one"? Do you mean having just the header and nothing below it? (As I said on Zulip, I'm fine with keeping the header, as long as it's clear that it's not supposed to have anything below it.)

@GuillaumeGomez
Copy link
Member

Yes, it's what I meant. It has a different style than the others sidebar headers but I guess it's not obvious, so if we keep it, we'll need to re-design it to fix it.

@bors
Copy link
Contributor

bors commented Dec 2, 2021

☔ The latest upstream changes (presumably #91291) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 30, 2022
@aDotInTheVoid
Copy link
Member Author

With the new sidebar design, this isnt under consideration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implementors column on trait page is always empty
8 participants