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

@ -621,7 +621,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
r: ty::Region<'tcx>,
) -> ty::Region<'tcx> {
let var = self.canonical_var(info, r.into());
let br = ty::BoundRegion { kind: ty::BrAnon(var.as_u32()) };
let br = ty::BoundRegion { var, kind: ty::BrAnon(var.as_u32()) };
let region = ty::ReLateBound(self.binder_index, br);
self.tcx().mk_region(region)
}

View file

@ -439,7 +439,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
// We only allow a `ty::INNERMOST` index in substitutions.
assert_eq!(debruijn, ty::INNERMOST);
opt_values[br.assert_bound_var()] = Some(*original_value);
opt_values[br.var] = Some(*original_value);
}
}
GenericArgKind::Const(result_value) => {

View file

@ -71,11 +71,10 @@ where
if var_values.var_values.is_empty() {
value
} else {
let fld_r =
|br: ty::BoundRegion| match var_values.var_values[br.assert_bound_var()].unpack() {
GenericArgKind::Lifetime(l) => l,
r => bug!("{:?} is a region but value is {:?}", br, r),
};
let fld_r = |br: ty::BoundRegion| match var_values.var_values[br.var].unpack() {
GenericArgKind::Lifetime(l) => l,
r => bug!("{:?} is a region but value is {:?}", br, r),
};
let fld_t = |bound_ty: ty::BoundTy| match var_values.var_values[bound_ty.var].unpack() {
GenericArgKind::Type(ty) => ty,