rust/compiler
bors d4822c2d84 Auto merge of #127589 - notriddle:notriddle/search-sem-3, r=GuillaumeGomez
rustdoc-search: simplify rules for generics and type params

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

Part of https://github.com/rust-lang/rust-project-goals/issues/112

This PR overturns https://github.com/rust-lang/rust/pull/109802

## Preview

* no results: [`Box<[A]> -> Vec<B>`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=Box%3C%5BA%5D%3E%20-%3E%20Vec%3CB%3E)
* results: [`Box<[A]> -> Vec<A>`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=Box%3C%5BA%5D%3E%20-%3E%20Vec%3CA%3E)
* [`T -> U`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=T%20-%3E%20U)
* [`Cx -> TyCtxt`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3-compiler/rustdoc/index.html?search=Cx%20-%3E%20TyCtxt)

![image](https://github.com/user-attachments/assets/015ae28c-7469-4f7f-be03-157d28d7ec97)

## 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

* <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149>
* <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265>
* <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search>
2024-11-11 12:26:00 +00:00
..
rustc Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_abi pointee_info_at: fix logic for recursing into enums 2024-11-08 07:35:29 +01:00
rustc_arena
rustc_ast Add documentation on ast::Attribute 2024-11-05 16:38:15 +01:00
rustc_ast_ir
rustc_ast_lowering Stabilize Arm64EC inline assembly 2024-11-10 17:43:46 +09:00
rustc_ast_passes Auto merge of #127589 - notriddle:notriddle/search-sem-3, r=GuillaumeGomez 2024-11-11 12:26:00 +00:00
rustc_ast_pretty fix clippy::clone_on_ref_ptr for compiler 2024-10-28 18:05:08 +03:00
rustc_attr remove support for extern-block const intrinsics 2024-11-04 23:27:45 +01:00
rustc_baked_icu_data
rustc_borrowck Dont suggest use<APIT> 2024-11-09 19:41:53 +00:00
rustc_builtin_macros Auto merge of #131284 - dingxiangfei2009:rename-smart-ptr-to-coerce-referent, r=compiler-errors 2024-10-27 17:04:12 +00:00
rustc_codegen_cranelift Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into sync_cg_clif-2024-11-09 2024-11-09 13:48:06 +00:00
rustc_codegen_gcc remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
rustc_codegen_llvm Auto merge of #132880 - RalfJung:implied-features, r=workingjubilee 2024-11-11 09:12:03 +00:00
rustc_codegen_ssa Rollup merge of #132774 - bjorn3:cranelift_lld, r=lqd 2024-11-09 19:16:45 +01:00
rustc_const_eval Rollup merge of #132823 - RalfJung:conditional-const-calls, r=fee1-dead,compiler-errors 2024-11-09 20:28:44 -08:00
rustc_data_structures
rustc_driver
rustc_driver_impl Use a method to apply RustcOptGroup to getopts::Options 2024-11-08 12:46:39 +11:00
rustc_error_codes remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead 2024-11-08 09:16:00 +01:00
rustc_error_messages
rustc_errors Auto merge of #126597 - estebank:unicode-output, r=fmease 2024-11-11 00:00:58 +00:00
rustc_expand Rollup merge of #132332 - nnethercote:use-token_descr-more, r=estebank 2024-10-30 06:40:36 +01:00
rustc_feature Rollup merge of #132552 - taiki-e:sparc-target-feature, r=workingjubilee 2024-11-09 10:52:03 +01:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #132423 - RalfJung:const-eval-align-offset, r=dtolnay 2024-11-03 20:08:13 -08:00
rustc_hir_analysis Rollup merge of #132757 - compiler-errors:yeet-check-wf, r=lcnr 2024-11-08 20:46:12 -08:00
rustc_hir_pretty compiler: Switch to rustc_abi in hir_pretty, lint_defs, and mir_build 2024-10-30 22:38:49 -07:00
rustc_hir_typeck Don't suggest .into_iter() on iterators 2024-11-08 17:43:13 -08:00
rustc_incremental replace manual time convertions with std ones 2024-11-03 15:51:39 +03:00
rustc_index
rustc_index_macros
rustc_infer Manually register some bounds for a better span 2024-11-08 04:56:08 +00:00
rustc_interface Use a method to apply RustcOptGroup to getopts::Options 2024-11-08 12:46:39 +11:00
rustc_lexer Reject raw lifetime followed by \' as well 2024-10-30 01:13:18 +00:00
rustc_lint Rollup merge of #132426 - Urgau:unreach_pub-super, r=petrochenkov 2024-11-10 22:20:35 +01:00
rustc_lint_defs Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errors 2024-11-10 02:52:25 +00:00
rustc_llvm Add discriminators to DILocations when multiple functions are inlined into a single point. 2024-11-09 08:01:31 -08:00
rustc_log
rustc_macros give a better error for tuple structs in derive(Diagnostic) 2024-10-27 21:23:28 -04:00
rustc_metadata Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errors 2024-11-07 18:48:22 -08:00
rustc_middle Auto merge of #132854 - RalfJung:query-key-limit, r=compiler-errors 2024-11-11 05:17:13 +00:00
rustc_mir_build Auto merge of #132580 - compiler-errors:globs, r=Noratrieb 2024-11-05 08:30:56 +00:00
rustc_mir_dataflow compiler: Remove unused rustc_target from Cargo.tomls 2024-11-03 13:38:47 -08:00
rustc_mir_transform Rollup merge of #132675 - Zalathar:empty-spans, r=jieyouxu 2024-11-10 17:43:07 +01:00
rustc_monomorphize Auto merge of #132173 - veluca93:abi_checks, r=RalfJung,compiler-errors 2024-11-10 02:52:25 +00:00
rustc_next_trait_solver Remove unused intercrate dependencies 2024-11-07 14:17:16 +00:00
rustc_parse Auto merge of #126597 - estebank:unicode-output, r=fmease 2024-11-11 00:00:58 +00:00
rustc_parse_format
rustc_passes Auto merge of #127589 - notriddle:notriddle/search-sem-3, r=GuillaumeGomez 2024-11-11 12:26:00 +00:00
rustc_pattern_analysis compiler: Remove unused rustc_target from Cargo.tomls 2024-11-03 13:38:47 -08:00
rustc_privacy Merge HostPolarity and BoundConstness 2024-10-30 16:23:16 +00:00
rustc_query_impl
rustc_query_system replace manual time convertions with std ones 2024-11-03 15:51:39 +03:00
rustc_resolve use verbose for path separator suggestion 2024-11-08 16:58:19 +00:00
rustc_sanitizers compiler: Add rustc_abi to _sanitizers 2024-11-02 20:31:47 -07:00
rustc_serialize
rustc_session Auto merge of #126597 - estebank:unicode-output, r=fmease 2024-11-11 00:00:58 +00:00
rustc_smir Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errors 2024-11-07 18:48:22 -08:00
rustc_span Auto merge of #127589 - notriddle:notriddle/search-sem-3, r=GuillaumeGomez 2024-11-11 12:26:00 +00:00
rustc_symbol_mangling ty::BrK -> ty::BoundRegionKind::K 2024-11-04 04:45:52 +00:00
rustc_target Auto merge of #132880 - RalfJung:implied-features, r=workingjubilee 2024-11-11 09:12:03 +00:00
rustc_trait_selection Dont suggest use<APIT> 2024-11-09 19:41:53 +00:00
rustc_traits TypingMode 🤔 2024-10-29 17:01:24 +01:00
rustc_transmute Rollup merge of #132255 - workingjubilee:layout-is-🏚️, r=compiler-errors 2024-10-28 10:18:50 -07:00
rustc_ty_utils Make fn_abi_sanity_check a bit stricter 2024-11-07 15:54:40 +00:00
rustc_type_ir Rename the FIXMEs, remove a few that dont matter anymore 2024-11-03 18:59:41 +00:00
rustc_type_ir_macros
stable_mir Rollup merge of #132161 - celinval:smir-fix-indent, r=compiler-errors 2024-11-08 18:51:28 +11:00