Add var to BoundRegion. Add query to get bound vars for applicable items.

This commit is contained in:
Jack Huey
2020-10-26 14:18:31 -04:00
parent 666859a6f8
commit 6d5efa9f04
53 changed files with 1274 additions and 385 deletions

View File

@@ -810,7 +810,7 @@ impl CanonicalUserType<'tcx> {
ty::ReLateBound(debruijn, br) => {
// We only allow a `ty::INNERMOST` index in substitutions.
assert_eq!(*debruijn, ty::INNERMOST);
cvar == br.assert_bound_var()
cvar == br.var
}
_ => false,
},
@@ -2672,6 +2672,17 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn object_lifetime_defaults(self, id: HirId) -> Option<Vec<ObjectLifetimeDefault>> {
self.object_lifetime_defaults_map(id.owner)
}
pub fn late_bound_vars(self, id: HirId) -> &'tcx List<ty::BoundVariableKind> {
self.mk_bound_variable_kinds(
self.late_bound_vars_map(id.owner)
.and_then(|map| map.get(&id.local_id).cloned())
.unwrap_or_else(|| {
bug!("No bound vars found for {:?} ({:?})", self.hir().node_to_string(id), id)
})
.iter(),
)
}
}
impl TyCtxtAt<'tcx> {