diff options
| author | Michael Howell <michael@notriddle.com> | 2023-03-07 10:06:42 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-03-07 11:20:49 -0700 |
| commit | a6446c53fe8be6692b07e121b831c3db770ff94a (patch) | |
| tree | 53a2359aaf4d1b4c7eeb8a3504b3f699179c4ae1 /src/librustdoc | |
| parent | 0a3b557d528dd7c8a88ceca6f7dc0699b89a3ef4 (diff) | |
rustdoc: fix type search index for `fn<T>() -> &T where T: Trait`
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/html/render/search_index.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs index e22ac6ec19b..483137f4c35 100644 --- a/src/librustdoc/html/render/search_index.rs +++ b/src/librustdoc/html/render/search_index.rs @@ -465,7 +465,7 @@ fn add_generics_and_bounds_as_types<'tcx, 'a>( } // First, check if it's "Self". - let arg = if let Some(self_) = self_ { + let mut arg = if let Some(self_) = self_ { match &*arg { Type::BorrowedRef { type_, .. } if type_.is_self_type() => self_, type_ if type_.is_self_type() => self_, @@ -475,6 +475,11 @@ fn add_generics_and_bounds_as_types<'tcx, 'a>( arg }; + // strip references from the argument type + while let Type::BorrowedRef { type_, .. } = &*arg { + arg = &*type_; + } + // If this argument is a type parameter and not a trait bound or a type, we need to look // for its bounds. if let Type::Generic(arg_s) = *arg { |
