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 doesn't handle generic associated types properly #92341

Closed
JanBeh opened this issue Dec 28, 2021 · 3 comments · Fixed by #94009
Closed

rustdoc doesn't handle generic associated types properly #92341

JanBeh opened this issue Dec 28, 2021 · 3 comments · Fixed by #94009
Assignees
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs GATs-blocking Issues using the `generic_associated_types` feature that block stabilization GATs-triaged Issues using the `generic_associated_types` feature that have been triaged T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@JanBeh
Copy link
Contributor

JanBeh commented Dec 28, 2021

I tried this code:

pub trait Machine<'a> {
    /// Data type representing values passed to or returned from machine
    type Datum<'b>
    where
        Self: 'b;
    /// Function (for example returned by [`Compile::compile`])
    /// which can be executed by the machine
    type Function<'b>: Function<Datum = Self::Datum<'b>>
    where
        Self: 'b;
}

I expected rustdoc to create proper documentation for these GATs.

Instead, rustdoc created the following output:

pub trait Machine<'a> {
    type Datum;
    type Function: Function<Datum = Self::Datum>;
}

and

Associated Types
[src]
type Datum

Data type representing values passed to or returned from machine
[src]
type Function: Function<Datum = Self::Datum>

Function (for example returned by Compile::compile) which can be executed by the machine

The lifetime argument 'b is missing in the documentation.

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (f8abed9ed 2021-12-26)
binary: rustc
commit-hash: f8abed9ed48bace6be0087bcd44ed534e239b8d8
commit-date: 2021-12-26
host: x86_64-unknown-freebsd
release: 1.59.0-nightly
LLVM version: 13.0.0
@JanBeh JanBeh added the C-bug Category: This is a bug. label Dec 28, 2021
@BGR360
Copy link
Contributor

BGR360 commented Dec 29, 2021

@rustbot label +T-rustdoc +F-generic_associated_types

@rustbot rustbot added F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 29, 2021
@jackh726
Copy link
Member

jackh726 commented Feb 7, 2022

GATs issue triage: blocking. I'm going to go ahead and mark this as blocking precisely because I want to elevate it's priority: in theory, this isn't a hard fix, but having proper documentation of code with GATs is kind of a big ergonomics win. In actuality, this can be demoted to not blocking if it actually turns out to be a really difficult problem or something.

@jackh726 jackh726 added GATs-blocking Issues using the `generic_associated_types` feature that block stabilization GATs-triaged Issues using the `generic_associated_types` feature that have been triaged labels Feb 7, 2022
@compiler-errors
Copy link
Member

@rustbot claim

having proper documentation of code with GATs is kind of a big ergonomics win.

Strongly agree. Stabilizing GATs when rustdocs don't properly render associated types' own generics is kinda a big problem, IMO.

this can be demoted to not blocking if it actually turns out to be a really difficult problem or something.

As far as I can tell, this doesn't seem too hard. I'm working through it right now. I've got GATs rendering in trait definitions fine right now, working through some rendering issues, but I can probably get help in the rustdoc zulip.

@bors bors closed this as completed in 6d76841 Mar 4, 2022
@fmease fmease added the A-GATs Area: Generic associated types (GATs) label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-GATs Area: Generic associated types (GATs) C-bug Category: This is a bug. F-generic_associated_types `#![feature(generic_associated_types)]` a.k.a. GATs GATs-blocking Issues using the `generic_associated_types` feature that block stabilization GATs-triaged Issues using the `generic_associated_types` feature that have been triaged 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.

6 participants