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] Generate documentation for type definitions #99952

Closed
elichai opened this issue Jul 30, 2022 · 3 comments · Fixed by #115201
Closed

[rustdoc] Generate documentation for type definitions #99952

elichai opened this issue Jul 30, 2022 · 3 comments · Fixed by #115201
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@elichai
Copy link
Contributor

elichai commented Jul 30, 2022

Would it be possible to add traits and functions to type definitions? For example, it's really hard to figure out what functions exist on this type: https://docs.rs/blake2/0.10.4/blake2/type.Blake2b.html
It's a type definition of a generic struct where some of the impls on the generic struct depend on the traits the generic implements.
so having docs on the type definition will allow seeing what traits/functions end up implemented on that type

@fmease
Copy link
Member

fmease commented Jul 31, 2022

@rustbot label T-rustdoc C-enhancement

@rustbot rustbot added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 31, 2022
@jsha
Copy link
Contributor

jsha commented Aug 8, 2022

I think this is equivalent to a request for #[doc(inline)] to be implemented on type definitions. Is that right? https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#inline-and-no_inline

@elichai
Copy link
Contributor Author

elichai commented Aug 9, 2022

I think this is equivalent to a request for #[doc(inline)] to be implemented on type definitions. Is that right? https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#inline-and-no_inline

Hmm I'm not sure, because I'm also proposing that if the type definition selects a specific generic type then the impls will change accordingly (e.g. if there are impl<T: SomeTrait> for Type<T> and the typedef is type A = Type<B> where B doesn't imply SomeTrait, then there's no reason to show that impl in the docs of A)

@bors bors closed this as completed in 1fb672c Sep 8, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 8, 2023
Rollup merge of rust-lang#115201 - notriddle:notriddle/type-alias-impl-list, r=GuillaumeGomez

rustdoc: list matching impls on type aliases

Fixes rust-lang#32077

Fixes rust-lang#99952

Remake of rust-lang#112429

Partially reverts rust-lang#112543, but keeps the test case.

This version of the PR avoids the infinite loop by structurally matching types instead of using full unification. This version does not support type alias trait bounds, but the compiler does not enforce those anyway (rust-lang#21903).

r? `@GuillaumeGomez`

CC `@lcnr`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants