rustdoc: fix type search index for fn<T>() -> &T where T: Trait
This commit is contained in:
parent
0a3b557d52
commit
a6446c53fe
3 changed files with 18 additions and 2 deletions
|
@ -465,7 +465,7 @@ fn add_generics_and_bounds_as_types<'tcx, 'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, check if it's "Self".
|
// First, check if it's "Self".
|
||||||
let arg = if let Some(self_) = self_ {
|
let mut arg = if let Some(self_) = self_ {
|
||||||
match &*arg {
|
match &*arg {
|
||||||
Type::BorrowedRef { type_, .. } if type_.is_self_type() => self_,
|
Type::BorrowedRef { type_, .. } if type_.is_self_type() => self_,
|
||||||
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
|
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
|
// If this argument is a type parameter and not a trait bound or a type, we need to look
|
||||||
// for its bounds.
|
// for its bounds.
|
||||||
if let Type::Generic(arg_s) = *arg {
|
if let Type::Generic(arg_s) = *arg {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const QUERY = ['trait<nested>', '-> trait<nested>', 't1, t2'];
|
const QUERY = ['trait<nested>', '-> trait<nested>', 't1, t2', '-> shazam'];
|
||||||
|
|
||||||
const EXPECTED = [
|
const EXPECTED = [
|
||||||
{
|
{
|
||||||
|
@ -16,4 +16,9 @@ const EXPECTED = [
|
||||||
{ 'path': 'where_clause', 'name': 'presto' },
|
{ 'path': 'where_clause', 'name': 'presto' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'others': [
|
||||||
|
{ 'path': 'where_clause', 'name': 'bippety' },
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -14,3 +14,9 @@ pub trait T2<'a, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn presto<A, B>(_: A, _: B) where A: T1, B: for <'b> T2<'b, Nested> {}
|
pub fn presto<A, B>(_: A, _: B) where A: T1, B: for <'b> T2<'b, Nested> {}
|
||||||
|
|
||||||
|
pub trait Shazam {}
|
||||||
|
|
||||||
|
pub fn bippety<X>() -> &'static X where X: Shazam {
|
||||||
|
panic!()
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue