Skip to content

rustdoc cannot inline associated data type #124596

Closed as not planned
Closed as not planned
@StackOverflowExcept1on

Description

@StackOverflowExcept1on

I tried this code:

// `cargo +stable doc`
pub struct Buffer<const N: usize>([u8; N]);

impl<'a, const N: usize> TryFrom<&'a [u8]> for Buffer<N> {
    type Error = <[u8; N] as TryFrom<&'a [u8]>>::Error;

    fn try_from(slice: &'a [u8]) -> Result<Self, Self::Error> {
        <[u8; N]>::try_from(slice).map(Self)
    }
}

I expected to see this happen: rustdoc can resolve type Error as std::array::TryFromSliceError

Instead, this happened: rustdoc can't inline type (i.e. it shows type Error = <[u8; N] as TryFrom<&'a [u8]>>::Error)

Meta

rustc --version --verbose:

rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: x86_64-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.T-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