Auto merge of #80163 - jackh726:binder-refactor-part-3, r=lcnr
Make BoundRegion have a kind of BoungRegionKind Split from #76814 Also includes making `replace_escaping_bound_vars` only return `T` Going to r? `@lcnr` Feel free to reassign
This commit is contained in:
commit
b1964e60b7
47 changed files with 183 additions and 181 deletions
|
@ -196,11 +196,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
|
||||
Some(rl::Region::LateBound(debruijn, id, _)) => {
|
||||
let name = lifetime_name(id.expect_local());
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, ty::BrNamed(id, name)))
|
||||
let br = ty::BoundRegion { kind: ty::BrNamed(id, name) };
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||
}
|
||||
|
||||
Some(rl::Region::LateBoundAnon(debruijn, index)) => {
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, ty::BrAnon(index)))
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(index) };
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||
}
|
||||
|
||||
Some(rl::Region::EarlyBound(index, id, _)) => {
|
||||
|
@ -2295,8 +2297,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
|
||||
fn validate_late_bound_regions(
|
||||
&self,
|
||||
constrained_regions: FxHashSet<ty::BoundRegion>,
|
||||
referenced_regions: FxHashSet<ty::BoundRegion>,
|
||||
constrained_regions: FxHashSet<ty::BoundRegionKind>,
|
||||
referenced_regions: FxHashSet<ty::BoundRegionKind>,
|
||||
generate_err: impl Fn(&str) -> rustc_errors::DiagnosticBuilder<'tcx>,
|
||||
) {
|
||||
for br in referenced_regions.difference(&constrained_regions) {
|
||||
|
|
|
@ -186,7 +186,8 @@ pub fn resolve_interior<'a, 'tcx>(
|
|||
// which means that none of the regions inside relate to any other, even if
|
||||
// typeck had previously found constraints that would cause them to be related.
|
||||
let folded = fcx.tcx.fold_regions(erased, &mut false, |_, current_depth| {
|
||||
let r = fcx.tcx.mk_region(ty::ReLateBound(current_depth, ty::BrAnon(counter)));
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(counter) };
|
||||
let r = fcx.tcx.mk_region(ty::ReLateBound(current_depth, br));
|
||||
counter += 1;
|
||||
r
|
||||
});
|
||||
|
|
|
@ -107,13 +107,12 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
|
|||
|
||||
let mk_va_list_ty = |mutbl| {
|
||||
tcx.lang_items().va_list().map(|did| {
|
||||
let region = tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(0)));
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
|
||||
let region = tcx
|
||||
.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { kind: ty::BrAnon(0) }));
|
||||
let env_region =
|
||||
tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { kind: ty::BrEnv }));
|
||||
let va_list_ty = tcx.type_of(did).subst(tcx, &[region.into()]);
|
||||
(
|
||||
tcx.mk_ref(tcx.mk_region(env_region), ty::TypeAndMut { ty: va_list_ty, mutbl }),
|
||||
va_list_ty,
|
||||
)
|
||||
(tcx.mk_ref(env_region, ty::TypeAndMut { ty: va_list_ty, mutbl }), va_list_ty)
|
||||
})
|
||||
};
|
||||
|
||||
|
@ -311,12 +310,12 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
|
|||
tcx.associated_items(tcx.lang_items().discriminant_kind_trait().unwrap());
|
||||
let discriminant_def_id = assoc_items.in_definition_order().next().unwrap().def_id;
|
||||
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(0) };
|
||||
(
|
||||
1,
|
||||
vec![tcx.mk_imm_ref(
|
||||
tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(0))),
|
||||
param(0),
|
||||
)],
|
||||
vec![
|
||||
tcx.mk_imm_ref(tcx.mk_region(ty::ReLateBound(ty::INNERMOST, br)), param(0)),
|
||||
],
|
||||
tcx.mk_projection(discriminant_def_id, tcx.mk_substs([param(0).into()].iter())),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -461,7 +461,7 @@ fn get_new_lifetime_name<'tcx>(
|
|||
.collect_referenced_late_bound_regions(&poly_trait_ref)
|
||||
.into_iter()
|
||||
.filter_map(|lt| {
|
||||
if let ty::BoundRegion::BrNamed(_, name) = lt {
|
||||
if let ty::BoundRegionKind::BrNamed(_, name) = lt {
|
||||
Some(name.as_str().to_string())
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue