rustdoc search: path distance algorithm is bad when crate and type share name
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
#![crate_name = "badranking"]
pub mod m {
pub fn foo() {}
pub struct BadRanking;
impl BadRanking {
pub fn foo() {}
}
}
Reproduction Steps
cargo doc --open- search
BadRanking::new
Expected Outcome
the method badranking::m::BadRanking::foo is the first result
Actual Output
the method badranking::m::BadRanking::foo is nowhere to be found, only badranking::m::foo is shown.
Version
rustdoc 1.88.0 (6b00bc388 2025-06-23)
Additional Details
discovered when searching for BitVec::new and it wasn't the first result.
on nightly both methods are show at least, but the order is still bad:
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 shown crate by running cargo doc --open and searching for BadRanking::new, then inspect rustdoc's search-ranking entry point and compare stable with nightly results. Done means badranking::m::BadRanking::foo appears in the results and ranks first for the query.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100