Skip to content

Commit 8ce92da

Browse files
authored
Rollup merge of #110904 - fmease:rustdoc-fix-110900, r=compiler-errors
rustdoc: rebind bound vars to type-outlives predicates Fixes #110900.
2 parents 29f5ec3 + 34d9688 commit 8ce92da

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

src/librustdoc/clean/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub(crate) fn clean_predicate<'tcx>(
304304
clean_region_outlives_predicate(pred)
305305
}
306306
ty::PredicateKind::Clause(ty::Clause::TypeOutlives(pred)) => {
307-
clean_type_outlives_predicate(pred, cx)
307+
clean_type_outlives_predicate(bound_predicate.rebind(pred), cx)
308308
}
309309
ty::PredicateKind::Clause(ty::Clause::Projection(pred)) => {
310310
Some(clean_projection_predicate(bound_predicate.rebind(pred), cx))
@@ -345,7 +345,7 @@ fn clean_poly_trait_predicate<'tcx>(
345345
}
346346

347347
fn clean_region_outlives_predicate<'tcx>(
348-
pred: ty::OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>,
348+
pred: ty::RegionOutlivesPredicate<'tcx>,
349349
) -> Option<WherePredicate> {
350350
let ty::OutlivesPredicate(a, b) = pred;
351351

@@ -358,13 +358,13 @@ fn clean_region_outlives_predicate<'tcx>(
358358
}
359359

360360
fn clean_type_outlives_predicate<'tcx>(
361-
pred: ty::OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>>,
361+
pred: ty::Binder<'tcx, ty::TypeOutlivesPredicate<'tcx>>,
362362
cx: &mut DocContext<'tcx>,
363363
) -> Option<WherePredicate> {
364-
let ty::OutlivesPredicate(ty, lt) = pred;
364+
let ty::OutlivesPredicate(ty, lt) = pred.skip_binder();
365365

366366
Some(WherePredicate::BoundPredicate {
367-
ty: clean_middle_ty(ty::Binder::dummy(ty), cx, None),
367+
ty: clean_middle_ty(pred.rebind(ty), cx, None),
368368
bounds: vec![GenericBound::Outlives(
369369
clean_middle_region(lt).expect("failed to clean lifetimes"),
370370
)],

tests/rustdoc-ui/issue-110900.rs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// check-pass
2+
3+
#![crate_type="lib"]
4+
#![feature(associated_type_bounds)]
5+
6+
trait A<'a> {}
7+
trait B<'b> {}
8+
9+
trait C<'c>: for<'a> A<'a> + for<'b> B<'b> {
10+
type As;
11+
}
12+
13+
trait E<'e> {
14+
type As;
15+
}
16+
trait F<'f>: for<'a> A<'a> + for<'e> E<'e> {}
17+
struct G<T>
18+
where
19+
T: for<'l, 'i> H<'l, 'i, As: for<'a> A<'a> + 'i>
20+
{
21+
t: std::marker::PhantomData<T>,
22+
}
23+
24+
trait I<'a, 'b, 'c> {
25+
type As;
26+
}
27+
28+
trait H<'d, 'e>: for<'f> I<'d, 'f, 'e> + 'd {}

0 commit comments

Comments
 (0)