Skip to content

rustdoc: array primitive auto trait impls are not always canonical #124931

Open

Description

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 and 1.75.0 docs.

Instead, this happened:

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.

1.64.0-1.80.0 docs impls
  • 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).

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

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

Metadata

Assignees

Labels

A-auto-traitsArea: auto traits (e.g., `auto trait Send {}`)A-synthetic-implsArea: Synthetic impls, used by rustdoc to document auto traits and traits with blanket implsC-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