Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -3906,6 +3906,8 @@ class DocSearch {
return name === "traitalias";
case "macro":
return name === "attr" || name === "derive";
case "import":
return name === "externcrate";
}

// No match
Expand Down
20 changes: 20 additions & 0 deletions tests/rustdoc-js/import-filter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This test ensures that when filtering on `import`, `externcrate` items are also displayed.
// It also ensures that the opposite is not true.

const EXPECTED = [
{
'query': 'import:st',
'others': [
{ 'path': 'foo', 'name': 'st', 'href': '../foo/index.html#reexport.st' },
// FIXME: `href` is wrong: <https://github.com/rust-lang/rust/issues/148300>
{ 'path': 'foo', 'name': 'st2', 'href': '../st2/index.html' },
],
},
{
'query': 'externcrate:st',
'others': [
// FIXME: `href` is wrong: <https://github.com/rust-lang/rust/issues/148300>
{ 'path': 'foo', 'name': 'st2', 'href': '../st2/index.html' },
],
},
];
7 changes: 7 additions & 0 deletions tests/rustdoc-js/import-filter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![crate_name = "foo"]

pub extern crate std as st2;

pub use crate::Bar as st;

pub struct Bar;
Loading