rustdoc: Weird display of `<ToBytes for Simd<_, _>>::Bytes` associated type
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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}>
(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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked rustdoc pages and the ToBytes/Simd rendering example, then compare it with the supplied Foo/Arr macro case to isolate the associated-type display path. Done means the SIMD associated type renders as valid Rust without the duplicated core path or unresolved macro tokens.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100