1
Fork 0

Change potentially_qualified to be defined on Binder<PredicateAtom>

This commit is contained in:
Jack Huey 2020-12-16 21:13:29 -05:00
parent e4297ba39c
commit af3b1cb0b5
4 changed files with 41 additions and 27 deletions

View file

@ -1919,10 +1919,11 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
} else {
let span = bound_pred.bounded_ty.span;
let re_root_empty = tcx.lifetimes.re_root_empty;
let predicate = ty::OutlivesPredicate(ty, re_root_empty);
let predicate = ty::Binder::bind(ty::PredicateAtom::TypeOutlives(
ty::OutlivesPredicate(ty, re_root_empty),
));
predicates.insert((
ty::PredicateAtom::TypeOutlives(predicate)
.potentially_quantified(tcx, ty::PredicateKind::ForAll),
predicate.potentially_quantified(tcx, ty::PredicateKind::ForAll),
span,
));
}
@ -1965,8 +1966,10 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
&hir::GenericBound::Outlives(ref lifetime) => {
let region = AstConv::ast_region_to_region(&icx, lifetime, None);
predicates.insert((
ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(ty, region))
.potentially_quantified(tcx, ty::PredicateKind::ForAll),
ty::Binder::bind(ty::PredicateAtom::TypeOutlives(
ty::OutlivesPredicate(ty, region),
))
.potentially_quantified(tcx, ty::PredicateKind::ForAll),
lifetime.span,
));
}
@ -1983,7 +1986,9 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
}
_ => bug!(),
};
let pred = ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(r1, r2));
let pred = ty::Binder::dummy(ty::PredicateAtom::RegionOutlives(
ty::OutlivesPredicate(r1, r2),
));
(pred.potentially_quantified(icx.tcx, ty::PredicateKind::ForAll), span)
}))
@ -2233,8 +2238,10 @@ fn predicates_from_bound<'tcx>(
}
hir::GenericBound::Outlives(ref lifetime) => {
let region = astconv.ast_region_to_region(lifetime, None);
let pred = ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(param_ty, region))
.potentially_quantified(astconv.tcx(), ty::PredicateKind::ForAll);
let pred = ty::Binder::dummy(ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(
param_ty, region,
)))
.potentially_quantified(astconv.tcx(), ty::PredicateKind::ForAll);
vec![(pred, lifetime.span)]
}
}

View file

@ -89,13 +89,15 @@ fn inferred_outlives_crate(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CratePredica
|(ty::OutlivesPredicate(kind1, region2), &span)| {
match kind1.unpack() {
GenericArgKind::Type(ty1) => Some((
ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(ty1, region2))
.potentially_quantified(tcx, ty::PredicateKind::ForAll),
ty::Binder::dummy(ty::PredicateAtom::TypeOutlives(
ty::OutlivesPredicate(ty1, region2),
))
.potentially_quantified(tcx, ty::PredicateKind::ForAll),
span,
)),
GenericArgKind::Lifetime(region1) => Some((
ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(
region1, region2,
ty::Binder::dummy(ty::PredicateAtom::RegionOutlives(
ty::OutlivesPredicate(region1, region2),
))
.potentially_quantified(tcx, ty::PredicateKind::ForAll),
span,