rust-lang / rust-lang/rust

Account for trait implementations and other kinds of deep searching

Open
#127,499 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-type-based-search C-bug T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

The essential problem is that this search query doesn't work the way it would be expected to:

Iterator<T>, (Fn(T) -> U) -> Iterator<U>

That sure looks like it would be the type signature of Iterator::map, but, technically, it's not. That's Iterator<T>, F -> Map<F>, because there's a special concrete type used there.

Iterator<Result<T>> -> Result<T>

Similarly, this looks like it would be Result::from_iter, but, again, it's not. It's technically IntoIterator<Result<T>> -> Result<T>

To make the search actually work, we need to account for trait implementations. From search.js's point of view, all of this can be treated like subtyping (in the language, that's not technically what it is, but this is a search engine and it can play faster and looser with things).

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 search.js and reproduce the two example queries involving Iterator::map and Result::from_iter. Trace how type signatures are matched, then verify that searches account for trait implementations as described and return the expected results.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.