-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
This means default methods can always be found and "Important traits" will include all spotlight traits.
(rust_highfive has picked a reviewer for you, use r? to override) |
|
||
pub fn record_extern_trait(cx: &DocContext, did: DefId) { | ||
cx.external_traits.borrow_mut().entry(did).or_insert_with(|| { | ||
build_external_trait(cx, did) |
There was a problem hiding this comment.
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]); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@bors r+ Thanks! |
📌 Commit 45cad04 has been approved by |
…, 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.
…, 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.
This means default methods can always be found and "Important traits" will include all spotlight traits.