rustdoc: default trait methods only show up in search index if they are overridden
Open
Nobody has claimed this yet.
A-rustdoc-js
A-rustdoc-search
C-bug
T-rustdoc
T-rustdoc-frontend
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
initially discovered when searching rustdoc internals for render_into
reproduction code
pub struct Empty;
impl Iterator for Empty {
type Item = ();
fn next(&mut self) -> Option<Self::Item> {
None
}
}
reproduction steps
cargo doc --open --no-deps- search for
count
expected result
Empty::count shows up as a result, since there is a method callable via that path
actual result
no search results
additional considerations
this could lead to flooding the search results, but hopefully that is no longer an issue once https://github.com/rust-lang/rust/issues/140782 is fixed.
version info
rustdoc 1.86.0 (05f9846f8 2025-03-31)
binary: rustdoc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: x86_64-unknown-linux-gnu
release: 1.86.0
LLVM version: 19.1.7
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
Start with the Rust code in the reproduction and run cargo doc --open --no-deps, then search for count in the generated documentation. Trace rustdoc's search-index handling for default trait methods; done means Empty::count appears as a search result even though it is not overridden.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100