rust-lang / rust-lang/rust

`Methods from Deref<Target=[T]>` doesnt appear for type aliases

Open
#134,868 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-rustdoc-js C-bug T-rustdoc T-rustdoc-frontend
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I have a type alias for a type that implements Deref<Target=[T], but Rustdoc doesnt generate the corresponding section in the sidebar like it does for the concrete type I'm aliasing

#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub struct Col<T: Copy, const N: usize> {
    data: [T; N],
}

pub type Mat<T, const H: usize, const W: usize> = Col<Col<T, W>, H>;

// snip

impl<T: Copy, const N: usize> Deref for Col<T, N> {
    type Target = [T];

    fn deref(&self) -> &Self::Target {
        &self.data
    }
}

rustdoc 1.82.0 (f6e511eec 2024-10-15) on macOS 15.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust reproducer in the issue and generate rustdoc for the concrete type and its type alias, comparing the sidebar sections. Trace how rustdoc handles methods from Deref for each form. Done means the alias documents the corresponding Deref methods consistently with the concrete type.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.