allow type-based search on foreign functions

fixes https://github.com/rust-lang/rust/issues/131804
This commit is contained in:
binarycat 2024-10-24 19:50:54 -05:00
parent bed75e7c21
commit 09773b4f24
3 changed files with 17 additions and 1 deletions

View File

@ -759,7 +759,10 @@ pub(crate) fn get_function_type_for_search<'tcx>(
}
});
let (mut inputs, mut output, where_clause) = match item.kind {
clean::FunctionItem(ref f) | clean::MethodItem(ref f, _) | clean::TyMethodItem(ref f) => {
clean::ForeignFunctionItem(ref f, _)
| clean::FunctionItem(ref f)
| clean::MethodItem(ref f, _)
| clean::TyMethodItem(ref f) => {
get_fn_inputs_and_outputs(f, tcx, impl_or_trait_generics, cache)
}
_ => return None,

View File

@ -0,0 +1,8 @@
const EXPECTED = [
{
'query': 'c_float -> c_float',
'others': [
{ 'path': 'extern_func', 'name': 'sqrt' }
],
},
];

View File

@ -0,0 +1,5 @@
use std::ffi::c_float;
extern "C" {
pub fn sqrt(x: c_float) -> c_float;
}