Skip to content

Commit 1063b1c

Browse files
committed
rustdoc: rebase after changes to bindings
1 parent ce1c4db commit 1063b1c

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src/librustdoc/clean/types.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1625,16 +1625,16 @@ impl Type {
16251625
}
16261626
}
16271627

1628-
pub(crate) fn generics(&self) -> Option<Vec<&Type>> {
1628+
pub(crate) fn generic_args(&self) -> Option<&GenericArgs> {
16291629
match self {
1630-
Type::Path { path, .. } => path.generics(),
1630+
Type::Path { path, .. } => path.generic_args(),
16311631
_ => None,
16321632
}
16331633
}
16341634

1635-
pub(crate) fn bindings(&self) -> Option<&[TypeBinding]> {
1635+
pub(crate) fn generics(&self) -> Option<Vec<&Type>> {
16361636
match self {
1637-
Type::Path { path, .. } => path.bindings(),
1637+
Type::Path { path, .. } => path.generics(),
16381638
_ => None,
16391639
}
16401640
}
@@ -2173,6 +2173,10 @@ impl Path {
21732173
}
21742174
}
21752175

2176+
pub(crate) fn generic_args(&self) -> Option<&GenericArgs> {
2177+
self.segments.last().map(|seg| &seg.args)
2178+
}
2179+
21762180
pub(crate) fn generics(&self) -> Option<Vec<&Type>> {
21772181
self.segments.last().and_then(|seg| {
21782182
if let GenericArgs::AngleBracketed { ref args, .. } = seg.args {

src/librustdoc/html/render/search_index.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -776,25 +776,15 @@ fn simplify_fn_type<'tcx, 'a>(
776776
// we will look for them but not for `T`).
777777
let mut ty_generics = Vec::new();
778778
let mut ty_bindings = Vec::new();
779-
for binding in arg.bindings().unwrap_or_default() {
780-
simplify_fn_binding(
781-
self_,
782-
generics,
783-
binding,
784-
tcx,
785-
recurse + 1,
786-
&mut ty_bindings,
787-
rgen,
788-
is_return,
789-
cache,
790-
);
791-
}
792-
if let Some(arg_generics) = arg.generics() {
793-
for gen in arg_generics.iter() {
779+
if let Some(arg_generics) = arg.generic_args() {
780+
for ty in arg_generics.into_iter().filter_map(|gen| match gen {
781+
clean::GenericArg::Type(ty) => Some(ty),
782+
_ => None,
783+
}) {
794784
simplify_fn_type(
795785
self_,
796786
generics,
797-
gen,
787+
&ty,
798788
tcx,
799789
recurse + 1,
800790
&mut ty_generics,
@@ -803,6 +793,19 @@ fn simplify_fn_type<'tcx, 'a>(
803793
cache,
804794
);
805795
}
796+
for binding in arg_generics.bindings() {
797+
simplify_fn_binding(
798+
self_,
799+
generics,
800+
&binding,
801+
tcx,
802+
recurse + 1,
803+
&mut ty_bindings,
804+
rgen,
805+
is_return,
806+
cache,
807+
);
808+
}
806809
}
807810
// Every trait associated type on self gets assigned to a type parameter index
808811
// this same one is used later for any appearances of these types

0 commit comments

Comments
 (0)