Skip to content

Commit 1ac7034

Browse files
committed
rustdoc: render for<> param lists of cross-crate trait-object types
1 parent 2d9755f commit 1ac7034

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Diff for: src/librustdoc/clean/mod.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub(crate) mod utils;
1212

1313
use rustc_ast as ast;
1414
use rustc_attr as attr;
15-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
15+
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
1616
use rustc_hir as hir;
1717
use rustc_hir::def::{CtorKind, DefKind, Res};
1818
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
@@ -1710,8 +1710,25 @@ pub(crate) fn clean_middle_ty<'tcx>(
17101710
})
17111711
.collect();
17121712

1713+
let late_bound_regions: FxIndexSet<_> = obj
1714+
.iter()
1715+
.flat_map(|pb| pb.bound_vars())
1716+
.filter_map(|br| match br {
1717+
ty::BoundVariableKind::Region(ty::BrNamed(_, name))
1718+
if name != kw::UnderscoreLifetime =>
1719+
{
1720+
Some(GenericParamDef {
1721+
name,
1722+
kind: GenericParamDefKind::Lifetime { outlives: vec![] },
1723+
})
1724+
}
1725+
_ => None,
1726+
})
1727+
.collect();
1728+
let late_bound_regions = late_bound_regions.into_iter().collect();
1729+
17131730
let path = external_path(cx, did, false, bindings, substs);
1714-
bounds.insert(0, PolyTrait { trait_: path, generic_params: Vec::new() });
1731+
bounds.insert(0, PolyTrait { trait_: path, generic_params: late_bound_regions });
17151732

17161733
DynTrait(bounds, lifetime)
17171734
}

0 commit comments

Comments
 (0)