Skip to content

rustdoc: generic constant expressions not displayed (and where clauses using said gces) #120994

Open

Description

This code

#![feature(generic_const_exprs)]
pub const fn assert_zero(x: usize) -> usize {
    if x != 0 {
        panic!("expected zero");
    } else {
        0
    }
}

pub fn chunked<const C: usize, const N: usize, T>(x: [T; N]) -> [[T; C]; N / C]
where
    [(); assert_zero(N % C)]:,
{
    unsafe {
        core::mem::ManuallyDrop::new(x)
            .as_ptr()
            .cast::<[[T; C]; N / C]>()
            .read()
    }
}

Produces this documentation

image

This is what i want

image

Meta

rustdoc 1.78.0-nightly (1a648b3 2024-02-11)

@GuillaumeGomez @fmease

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`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