Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez

rustdoc-search: handle `impl Into<X>` better

This PR fixes two bugs I ran into while searching the compiler docs:

- It omitted an `impl Trait` entry in the type signature field, producing `TyCtxt, , Symbol -> bool`
- It didn't let me search for `TyCtxt, DefId, Symbol -> bool` even though that's a perfectly good description of the function I was looking for (the function actually used `impl Into<DefId>`

r? ``@GuillaumeGomez`` cc ``@lolbinarycat``
This commit is contained in:
Matthias Krüger 2024-12-16 20:00:20 +01:00 committed by GitHub
commit d9ba4bf6fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 72 additions and 8 deletions

View file

@ -0,0 +1,35 @@
// exact-check
// ignore-order
const EXPECTED = [
{
'query': 'tyctxt, symbol -> bool',
'others': [
{
'path': 'foo::TyCtxt',
'name': 'has_attr',
'displayType': "`TyCtxt`, Into<DefId>, `Symbol` -> `bool`",
},
],
},
{
'query': 'tyctxt, into<defid>, symbol -> bool',
'others': [
{
'path': 'foo::TyCtxt',
'name': 'has_attr',
'displayType': "`TyCtxt`, `Into`<`DefId`>, `Symbol` -> `bool`",
},
],
},
{
'query': 'tyctxt, defid, symbol -> bool',
'others': [
{
'path': 'foo::TyCtxt',
'name': 'has_attr',
'displayType': "`TyCtxt`, Into<`DefId`>, `Symbol` -> `bool`",
},
],
},
];

View file

@ -0,0 +1,11 @@
#![crate_name = "foo"]
pub struct TyCtxt;
pub struct DefId;
pub struct Symbol;
impl TyCtxt {
pub fn has_attr(self, _did: impl Into<DefId>, _attr: Symbol) -> bool {
unimplemented!();
}
}