rustdoc leaks private types in Implementations on Foreign Types
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Problem
When a pub trait is implemented on a constructed type—not counting references if those are "type constructors"—that was constructed based on a private type, it is shown in the documentation. Ideally it would not do this as I like private types to not leak into my documentation. The type constructor has to be pub of course (e.g., a slice).
Steps
/// `Foo`.
pub trait Foo {}
/// `Fizz`.
struct Fizz;
impl Foo for [Fizz] {}
cargo doc --open will generate documentation that shows the trait Foo. When clicking on it, it will show impl Foo for [Fizz] under "Implementations on Foreign Types".
Possible Solution(s)
No response
Notes
No response
Version
[zack@laptop src]$ cargo version --verbose
cargo 1.79.0 (ffa9cf99a 2024-06-03)
release: 1.79.0
commit-hash: ffa9cf99a594e59032757403d4c780b46dc2c43a
commit-date: 2024-06-03
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Arch Linux [64-bit]
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
Reproduce the issue with the Rust snippet and run cargo doc --open to inspect the generated "Implementations on Foreign Types" entry. Start at the rustdoc handling for implementations involving constructed types, then verify that impls based on private types are omitted while valid public implementations remain documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100