Skip to content

rustdoc-search: simplify rules for generics and type params#127589

Merged
bors merged 7 commits intorust-lang:masterfrom
notriddle:notriddle/search-sem-3
Nov 11, 2024
Merged

rustdoc-search: simplify rules for generics and type params#127589
bors merged 7 commits intorust-lang:masterfrom
notriddle:notriddle/search-sem-3

Conversation

@notriddle
Copy link
Copy Markdown
Contributor

@notriddle notriddle commented Jul 10, 2024

Heads up!: This PR is a follow-up that depends on #124544. It adds 12dc24f, a change to the filtering behavior, and 9900ea4, a minor ranking tweak.

Part of rust-lang/rust-project-goals#112

This PR overturns #109802

Preview

image

Description

This commit is a response to feedback on the displayed type signatures results, by making generics act stricter.

  • Order within generics is significant. This means Vec<Allocator> now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so Result<A, B> only matches if B is in the error type and A is in the success type. The top level of the function search is unaffected.
  • Generics are only "unboxed" if a type is explicitly opted into it. References and tuples are hardcoded to allow unboxing, and Box, Rc, Arc, Option, Result, and Future are opted in with an unstable attribute. Search result unboxing is the process that allows you to search for i32 -> str and get back a function with the type signature &Future<i32> -> Box<str>.
  • Instead of ranking by set overlap, it ranks by the number of items in the type signature. This makes it easier to find single type signatures like transmute.

Find the discussion on

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.