rust-lang / rust-lang/rust

Docs & `rustdoc`: Mark traits that have indirect and synthetic impls

Open
#133,573 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

There's a lot of implicit stuff going on behind the scenes in Rust that's dictated by the very nature of the trait-based type systems. However, that doesn't change the fact that hidden complexity makes it difficult to understand other people's code and write your own, let alone learn the language for newbies.

One example of such complexity is side effects of importing traits from other modules, when seemingly familiar types can suddenly acquire new methods and even operational semantics. But since we can declare the use of elements without naming each of them individually, with asterisk wildcard syntax, these methods begin to look like as though they came out of nowhere. And sometimes this approach is even preferable and officially recommended - see e.g. std::io::prelude.

This problem could be greatly mitigated if such traits were distinctly marked out on overview pages. This includes:

  • Traits that have blanket implementations. The most prominent example here is Any.
  • Traits that have implementations on foreign types, along with generic (i.e. covered) ones. A good illustration of it is zerocopy::Unaligned.
  • Auto traits: as of 1.82.0, this is Send, Sync, Unpin, UnwindSafe, RefUnwindSafe, Freeze (unstable) and Sized.
    They don't quite fit the stated criterion, but are close to it in spirit, so I think it would be nice to also highlight them from the general mass.

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 by locating rustdoc's trait overview rendering and checking how blanket, foreign, generic, and auto-trait implementations are currently represented. Compare the affected examples in the issue, then define a consistent visible marker for each applicable trait category and verify the generated overview pages show it without obscuring existing implementation information.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.