Skip to content

Commit b675478

Browse files
committed
rustdoc: rebase after changes to bindings
1 parent f1f13b9 commit b675478

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
@@ -1651,16 +1651,16 @@ impl Type {
16511651
}
16521652
}
16531653

1654-
pub(crate) fn generics(&self) -> Option<Vec<&Type>> {
1654+
pub(crate) fn generic_args(&self) -> Option<&GenericArgs> {
16551655
match self {
1656-
Type::Path { path, .. } => path.generics(),
1656+
Type::Path { path, .. } => path.generic_args(),
16571657
_ => None,
16581658
}
16591659
}
16601660

1661-
pub(crate) fn bindings(&self) -> Option<&[TypeBinding]> {
1661+
pub(crate) fn generics(&self) -> Option<Vec<&Type>> {
16621662
match self {
1663-
Type::Path { path, .. } => path.bindings(),
1663+
Type::Path { path, .. } => path.generics(),
16641664
_ => None,
16651665
}
16661666
}
@@ -2198,6 +2198,10 @@ impl Path {
21982198
}
21992199
}
22002200

2201+
pub(crate) fn generic_args(&self) -> Option<&GenericArgs> {
2202+
self.segments.last().map(|seg| &seg.args)
2203+
}
2204+
22012205
pub(crate) fn generics(&self) -> Option<Vec<&Type>> {
22022206
self.segments.last().and_then(|seg| {
22032207
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
@@ -806,25 +806,15 @@ fn simplify_fn_type<'tcx, 'a>(
806806
// we will look for them but not for `T`).
807807
let mut ty_generics = Vec::new();
808808
let mut ty_bindings = Vec::new();
809-
for binding in arg.bindings().unwrap_or_default() {
810-
simplify_fn_binding(
811-
self_,
812-
generics,
813-
binding,
814-
tcx,
815-
recurse + 1,
816-
&mut ty_bindings,
817-
rgen,
818-
is_return,
819-
cache,
820-
);
821-
}
822-
if let Some(arg_generics) = arg.generics() {
823-
for gen in arg_generics.iter() {
809+
if let Some(arg_generics) = arg.generic_args() {
810+
for ty in arg_generics.into_iter().filter_map(|gen| match gen {
811+
clean::GenericArg::Type(ty) => Some(ty),
812+
_ => None,
813+
}) {
824814
simplify_fn_type(
825815
self_,
826816
generics,
827-
gen,
817+
&ty,
828818
tcx,
829819
recurse + 1,
830820
&mut ty_generics,
@@ -833,6 +823,19 @@ fn simplify_fn_type<'tcx, 'a>(
833823
cache,
834824
);
835825
}
826+
for binding in arg_generics.bindings() {
827+
simplify_fn_binding(
828+
self_,
829+
generics,
830+
&binding,
831+
tcx,
832+
recurse + 1,
833+
&mut ty_bindings,
834+
rgen,
835+
is_return,
836+
cache,
837+
);
838+
}
836839
}
837840
// Every trait associated type on self gets assigned to a type parameter index
838841
// this same one is used later for any appearances of these types

0 commit comments

Comments
 (0)