Skip to content

Commit 8f5a308

Browse files
committed
rustdoc: Also index impl Traits and raw pointers
`dyn Trait`s and references are indexed, so these should be as well.
1 parent 78fd0f6 commit 8f5a308

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/librustdoc/html/render/search_index.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,24 @@ fn get_index_type_name(clean_type: &clean::Type) -> Option<Symbol> {
215215
let path = &bounds[0].trait_;
216216
Some(path.segments.last().unwrap().name)
217217
}
218+
clean::ImplTrait(ref bounds) => {
219+
let first_trait = bounds.iter().find_map(|b| match b {
220+
clean::GenericBound::TraitBound(poly_trait, _) => Some(&poly_trait.trait_),
221+
clean::GenericBound::Outlives(_) => None,
222+
});
223+
first_trait.map(|t| t.segments.last().unwrap().name)
224+
}
218225
clean::Generic(s) => Some(s),
219226
clean::Primitive(ref p) => Some(p.as_sym()),
220-
clean::BorrowedRef { ref type_, .. } => get_index_type_name(type_),
227+
clean::BorrowedRef { ref type_, .. } | clean::RawPointer(_, ref type_) => {
228+
get_index_type_name(type_)
229+
}
221230
clean::BareFunction(_)
222231
| clean::Tuple(_)
223232
| clean::Slice(_)
224233
| clean::Array(_, _)
225-
| clean::RawPointer(_, _)
226234
| clean::QPath { .. }
227-
| clean::Infer
228-
| clean::ImplTrait(_) => None,
235+
| clean::Infer => None,
229236
}
230237
}
231238

0 commit comments

Comments
 (0)