Skip to content

Commit 05f784c

Browse files
Rollup merge of #132123 - lolbinarycat:rustdoc-search-foreign-func, r=notriddle
allow type-based search on foreign functions fixes #131804 preferably will be merged after #129708, but that may take a while to be approved due to being a new feature, whereas this is definitely a bug, and should be fixed.
2 parents f7cf41c + 09773b4 commit 05f784c

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/librustdoc/html/render/search_index.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,10 @@ pub(crate) fn get_function_type_for_search<'tcx>(
759759
}
760760
});
761761
let (mut inputs, mut output, where_clause) = match item.kind {
762-
clean::FunctionItem(ref f) | clean::MethodItem(ref f, _) | clean::TyMethodItem(ref f) => {
762+
clean::ForeignFunctionItem(ref f, _)
763+
| clean::FunctionItem(ref f)
764+
| clean::MethodItem(ref f, _)
765+
| clean::TyMethodItem(ref f) => {
763766
get_fn_inputs_and_outputs(f, tcx, impl_or_trait_generics, cache)
764767
}
765768
_ => return None,

tests/rustdoc-js/extern-func.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const EXPECTED = [
2+
{
3+
'query': 'c_float -> c_float',
4+
'others': [
5+
{ 'path': 'extern_func', 'name': 'sqrt' }
6+
],
7+
},
8+
];

tests/rustdoc-js/extern-func.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
use std::ffi::c_float;
2+
3+
extern "C" {
4+
pub fn sqrt(x: c_float) -> c_float;
5+
}

0 commit comments

Comments
 (0)