Skip to content

rustdoc: Weird display of <ToBytes for Simd<_, _>>::Bytes associated type #129165

Open
@GoldsteinE

Description

@GoldsteinE

Implementations of ToBytes for various portable SIMD vectors are rendered incorrectly:

type Bytes = Simd<u8, core::::core_simd::to_bytes::{impl#55}::Bytes::{constant#0}>

https://doc.rust-lang.org/nightly/std/simd/prelude/struct.Simd.html#impl-ToBytes-for-Simd%3Cf32,+8%3E

(looks the same on stable: https://doc.rust-lang.org/stable/std/simd/prelude/struct.Simd.html#impl-ToBytes-for-Simd%3Cf32,+8%3E)

It’s probably reproducible with some other traits and types, but I was not able to do it. Notably, this:

pub trait Foo {
    type Bar;
}

struct Arr<T, const N: usize>(T);

macro_rules! gen_impl {
    ($a:literal, [$($b:literal),*]) => {
        $(impl Foo for [u8; $b] {
            type Bar = Arr<u8, { $a * $b }>;
        })*
    };
}

gen_impl!(2, [3, 4]);

renders as

type Bar = Arr<u8, { $a * $b }>

for me (stable + rustc 1.82.0-nightly (64ebd39da 2024-08-03)), which is maybe not perfect, but isn’t that broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)A-cross-crate-reexportsArea: Documentation that has been re-exported from a different crateC-bugCategory: This is a bug.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