about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-02-17 10:35:19 -0700
committerGitHub <noreply@github.com>2023-02-17 10:35:19 -0700
commit0e3ae605bc245e0fb25e04c5f99d398d8a2b5c09 (patch)
treed8cf47803592b278e7ce03a165d603887f2f0700
parent5eba3f688cc6c2efc545c346675a5186da03e1fd (diff)
downloadrust-0e3ae605bc245e0fb25e04c5f99d398d8a2b5c09.tar.gz
rust-0e3ae605bc245e0fb25e04c5f99d398d8a2b5c09.zip
Add comment explaining the search index tweak
-rw-r--r--src/librustdoc/formats/cache.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs
index d25824a88ee..fe7081b571a 100644
--- a/src/librustdoc/formats/cache.rs
+++ b/src/librustdoc/formats/cache.rs
@@ -288,6 +288,12 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
                         let last = self.cache.parent_stack.last().expect("parent_stack is empty 2");
                         let did = match &*last {
                             ParentStackItem::Impl {
+                                // impl Trait for &T { fn method(self); }
+                                //
+                                // When generating a function index with the above shape, we want it
+                                // associated with `T`, not with the primitive reference type. It should
+                                // show up as `T::method`, rather than `reference::method`, in the search
+                                // results page.
                                 for_: clean::Type::BorrowedRef { type_, .. },
                                 ..
                             } => type_.def_id(&self.cache),