Repository: rust
Issue: rustdoc: array primitive auto trait impls are not always canonical
Labels: T-rustdoc,C-bug,A-synthetic-impls,A-auto-traits

<!--
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
along with any information you feel relevant to replicating the bug.
-->

I looked at the "Auto Traits" section of the rustdoc page for `array`.

I expected to see this: `impl<T, const N: usize> Unpin for [T; N] where T: Unpin` (etc for other auto traits), this is the case on [1.77.0 docs](https://doc.rust-lang.org/1.77.0/std/primitive.array.html#synthetic-implementations) and [1.75.0 docs](https://doc.rust-lang.org/1.75.0/std/primitive.array.html#synthetic-implementations).

Instead, this happened:

* On [1.76.0 stable docs](https://doc.rust-lang.org/1.76.0/std/primitive.array.html#synthetic-implementations), [1.78.0 stable docs](https://doc.rust-lang.org/1.78.0/std/primitive.array.html#synthetic-implementations) and [current beta docs](https://doc.rust-lang.org/beta/std/primitive.array.html#synthetic-implementations): `impl<const N: usize> Unpin for [u8; N]` (etc)
* On [nightly docs](https://doc.rust-lang.org/nightly/std/primitive.array.html#synthetic-implementations) and local `core` docs build: `impl<T, const N: usize> Unpin for [MaybeUninit<T>; N] where T: Unpin`

This might be somewhat nondeterministic? It appears to change between the three `[u8; N]`, `[MaybeUninit<T>; N]` and `[T; N` in `std`  since 1.66.0, while it's always `[MaybeUninit<T>; N]` in `core` since 1.66.0.

<details> <summary>1.64.0-1.83.0 docs impls</summary>

* 1.83.0: std: `[MaybeUninit<T>; N]`, core: `[MaybeUninit<T>; N]`
* 1.82.0: std: `[MaybeUninit<T>; N]`, core: `[MaybeUninit<T>; N]`
* 1.81.0: std: `[T; N]`, core: `[MaybeUninit<T>; N]`
* 1.80.0: std: `[u8; N]`, core: `[MaybeUninit<T>; N]`
* 1.79.0: std: `[T; N]`, core: `[MaybeUninit<T>; N]`
* 1.78.0: std: `[u8; N]`, core: `[MaybeUninit<T>; N]`
* 1.77.0: std: `[T; N]`, core: `[MaybeUninit<T>; N]`
* 1.76.0: std: `[u8; N]`, core: `[MaybeUninit<T>; N]`
* 1.75.0: std: `[T; N]`, core: `[MaybeUninit<T>; N]`
* 1.74.0: std & core: `[MaybeUninit<T>; N]`
* 1.73.0: std & core: `[MaybeUninit<T>; N]`
* 1.72.0: std: `[u8; N]`, core: `[MaybeUninit<T>; N]`
* 1.71.0: std: `[T; N]`, core: `[MaybeUninit<T>; N]`
* 1.70.0: std & core: `[MaybeUninit<T>; N]`
* 1.69.0: std & core: `[MaybeUninit<T>; N]`
* 1.68.0: std & core: `[MaybeUninit<T>; N]`
* 1.67.0: std: `[T; N]`, core: `[MaybeUninit<T>; N]`
* 1.66.0: std & core: `[MaybeUninit<T>; N]`
* 1.65.0: std & core: `[T; N]`
* 1.64.0: std & core: `[T; N]`

(found using `for i in {78..64}; do echo -n "1.${i}.0: "; curl https://doc.rust-lang.org/1.${i}.0/std/primitive.array.html 2>/dev/null | grep -o 'impl-Unpin-for-[^"]*' | head -1 | python3 -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()));"; done | sed 's/impl-Unpin-for-//'`, and `.../core/...`) (Versions <=1.63.0 only have an `impl-Unpin`  anchor instead of `impl-Unpin-for-<urlencoded-type>` and I didn't want to do *that* much regex right now).

</details>

Based on these it looks like something may have changed 1.65.0 -> 1.66.0? It appears to be correct for versions between `1.47.0`..=`1.65.0` (AFAICT rustdoc started showing auto traits on array in 1.47.0).

Note that the specific type that is selected appears to be the same for all the auto traits on one version in one crate, and `core` seems to always use `[MaybeUninit<T>; N]` since 1.66.0.

@rustbot label +T-rustdoc A-auto-traits A-synthetic-impls