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: Populate external_traits with traits only seen in impls #47313

Merged
merged 1 commit into from
Jan 18, 2018

Conversation

ollie27
Copy link
Member

@ollie27 ollie27 commented Jan 10, 2018

This means default methods can always be found and "Important traits" will include all spotlight traits.

This means default methods can always be found and "Important traits" will include all spotlight traits.
@rust-highfive
Copy link
Collaborator

r? @steveklabnik

(rust_highfive has picked a reviewer for you, use r? to override)

@kennytm kennytm added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-dev-tools-rustdoc labels Jan 10, 2018

pub fn record_extern_trait(cx: &DocContext, did: DefId) {
cx.external_traits.borrow_mut().entry(did).or_insert_with(|| {
build_external_trait(cx, did)
Copy link
Member

Choose a reason for hiding this comment

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

Nice optimization here. 😉

@@ -3458,7 +3457,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
}

let traits = &cache().traits;
let trait_ = i.trait_did().and_then(|did| traits.get(&did));
let trait_ = i.trait_did().map(|did| &traits[&did]);
Copy link
Member

Choose a reason for hiding this comment

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

What's with the change here (and above)? Change the failure mode for missing DefIds?

Copy link
Member Author

Choose a reason for hiding this comment

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

There now shouldn't be any cases where the trait is missing from the traits map so this change is to make sure it stays like that.

@QuietMisdreavus
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Jan 15, 2018

📌 Commit 45cad04 has been approved by QuietMisdreavus

kennytm added a commit to kennytm/rust that referenced this pull request Jan 17, 2018
…, r=QuietMisdreavus

rustdoc: Populate external_traits with traits only seen in impls

This means default methods can always be found and "Important traits" will include all spotlight traits.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 17, 2018
…, r=QuietMisdreavus

rustdoc: Populate external_traits with traits only seen in impls

This means default methods can always be found and "Important traits" will include all spotlight traits.
bors added a commit that referenced this pull request Jan 18, 2018
Rollup of 6 pull requests

- Successful merges: #47250, #47313, #47398, #47468, #47471, #47520
- Failed merges:
@bors bors merged commit 45cad04 into rust-lang:master Jan 18, 2018
@ollie27 ollie27 deleted the rustdoc_record_extern_trait branch January 18, 2018 17:32
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants