Skip to content

Commit 0e3ae60

Browse files
authored
Add comment explaining the search index tweak
1 parent 5eba3f6 commit 0e3ae60

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustdoc/formats/cache.rs

+6
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
288288
let last = self.cache.parent_stack.last().expect("parent_stack is empty 2");
289289
let did = match &*last {
290290
ParentStackItem::Impl {
291+
// impl Trait for &T { fn method(self); }
292+
//
293+
// When generating a function index with the above shape, we want it
294+
// associated with `T`, not with the primitive reference type. It should
295+
// show up as `T::method`, rather than `reference::method`, in the search
296+
// results page.
291297
for_: clean::Type::BorrowedRef { type_, .. },
292298
..
293299
} => type_.def_id(&self.cache),

0 commit comments

Comments
 (0)