Skip to content

Commit a53a098

Browse files
committed
Auto merge of #26293 - mihneadb:rustdoc-search-orphan-methods, r=alexcrichton
In #23289, I did not include the type information for searching for orphan methods (methods that are defined in a module and implemented in another - doing this causes rustdoc sometimes to first find the impl before the actual type). This PR fixes this. By merging this, searches for `char -> bool` will also find `is_alphabetic`, for example (which otherwise was only found for `charext -> bool`). cc @alexcrichton
2 parents d9b8015 + 434684b commit a53a098

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustdoc/html/render.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,15 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result<String> {
456456
let did = ast_util::local_def(pid);
457457
match paths.get(&did) {
458458
Some(&(ref fqp, _)) => {
459+
// Needed to determine `self` type.
460+
let parent_basename = Some(fqp[fqp.len() - 1].clone());
459461
search_index.push(IndexItem {
460462
ty: shortty(item),
461463
name: item.name.clone().unwrap(),
462464
path: fqp[..fqp.len() - 1].connect("::"),
463465
desc: shorter(item.doc_value()),
464466
parent: Some(did),
465-
search_type: None,
467+
search_type: get_index_search_type(&item, parent_basename),
466468
});
467469
},
468470
None => {}

0 commit comments

Comments
 (0)