-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fix "kind" for associated types in trait implementations in rustdoc JSON #98577
Conversation
514e021
to
9277f95
Compare
Am I correct in guessing that this PR is an alternative to #98548 ? |
Yes. EDIT: Ok extra explanations: since we're now generating the correct |
@bors r+ |
📌 Commit 9277f95 has been approved by |
…askrgr Rollup of 9 pull requests Successful merges: - rust-lang#98331 (Fix rustdoc argument error) - rust-lang#98506 (Fix span issues in object safety suggestions) - rust-lang#98563 (interpret: refactor allocation info query) - rust-lang#98576 (small regions refactoring) - rust-lang#98577 (Fix "kind" for associated types in trait implementations in rustdoc JSON) - rust-lang#98578 (Remove eddyb from miri failure pings) - rust-lang#98579 (liballoc tests: avoid int2ptr cast) - rust-lang#98581 (Add triagebot mentions.) - rust-lang#98587 (libcore tests: avoid int2ptr casts) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@@ -252,8 +252,11 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum { | |||
bounds: b.into_iter().map(|x| x.into_tcx(tcx)).collect(), | |||
default: None, | |||
}, | |||
// FIXME: do not map to Typedef but to a custom variant | |||
AssocTypeItem(t, _) => ItemEnum::Typedef(t.into_tcx(tcx)), | |||
AssocTypeItem(t, b) => ItemEnum::AssocType { |
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.
My nightly regression test job for cargo public-api
found a regression with this change (job)
Reported as #98658
AssocTypeItem(t, b) => ItemEnum::AssocType { | ||
generics: t.generics.into_tcx(tcx), | ||
bounds: b.into_iter().map(|x| x.into_tcx(tcx)).collect(), | ||
default: t.item_type.map(|ty| ty.into_tcx(tcx)), |
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.
Comparing with the HTML rendering code I think this line should be something like
default: t.item_type.unwrap_or(t.type_).map(|ty| ty.into_tcx(tcx))
I will maybe have time later today to try that fix.
Fixes #81340.
Contrary to what is suggested in the issue, I really think we should distinguish between associated items and "normal" constants and types.
cc @CraftSpider @SimonSapin
r? @notriddle