Skip to content

rustdoc doesn't handle generic associated types properly #92341

Closed
@JanBeh

Description

@JanBeh

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

Metadata

Metadata

Labels

A-GATsArea: Generic associated types (GATs)C-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsGATs-blockingIssues using the `generic_associated_types` feature that block stabilizationGATs-triagedIssues using the `generic_associated_types` feature that have been triagedT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions