1
Fork 0

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:
bors 2020-12-20 07:01:00 +00:00
commit b1964e60b7
47 changed files with 183 additions and 181 deletions

View file

@ -496,7 +496,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
// lifetimes without names with the value `'0`.
match ty.kind() {
ty::Ref(
ty::RegionKind::ReLateBound(_, br)
ty::RegionKind::ReLateBound(_, ty::BoundRegion { kind: br })
| ty::RegionKind::RePlaceholder(ty::PlaceholderRegion { name: br, .. }),
_,
_,
@ -517,7 +517,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
let region = match ty.kind() {
ty::Ref(region, _, _) => {
match region {
ty::RegionKind::ReLateBound(_, br)
ty::RegionKind::ReLateBound(_, ty::BoundRegion { kind: br })
| ty::RegionKind::RePlaceholder(ty::PlaceholderRegion { name: br, .. }) => {
printer.region_highlight_mode.highlighting_bound_region(*br, counter)
}

View file

@ -138,7 +138,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
/// Returns `true` if a closure is inferred to be an `FnMut` closure.
fn is_closure_fn_mut(&self, fr: RegionVid) -> bool {
if let Some(ty::ReFree(free_region)) = self.to_error_region(fr) {
if let ty::BoundRegion::BrEnv = free_region.bound_region {
if let ty::BoundRegionKind::BrEnv = free_region.bound_region {
if let DefiningTy::Closure(_, substs) =
self.regioncx.universal_regions().defining_ty
{

View file

@ -281,7 +281,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
}
ty::ReFree(free_region) => match free_region.bound_region {
ty::BoundRegion::BrNamed(region_def_id, name) => {
ty::BoundRegionKind::BrNamed(region_def_id, name) => {
// Get the span to point to, even if we don't use the name.
let span = tcx.hir().span_if_local(region_def_id).unwrap_or(DUMMY_SP);
debug!(
@ -307,7 +307,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
}
}
ty::BoundRegion::BrEnv => {
ty::BoundRegionKind::BrEnv => {
let def_ty = self.regioncx.universal_regions().defining_ty;
if let DefiningTy::Closure(_, substs) = def_ty {
@ -349,7 +349,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
}
}
ty::BoundRegion::BrAnon(_) => None,
ty::BoundRegionKind::BrAnon(_) => None,
},
ty::ReLateBound(..)

View file

@ -700,7 +700,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
debug!("replace_bound_regions_with_nll_infer_vars: br={:?}", br);
let liberated_region = self.tcx.mk_region(ty::ReFree(ty::FreeRegion {
scope: all_outlive_scope.to_def_id(),
bound_region: br,
bound_region: br.kind,
}));
let region_vid = self.next_nll_region_var(origin);
indices.insert_late_bound_region(liberated_region, region_vid.to_region_vid());
@ -795,7 +795,7 @@ fn for_each_late_bound_region_defined_on<'tcx>(
let region_def_id = tcx.hir().local_def_id(hir_id);
let liberated_region = tcx.mk_region(ty::ReFree(ty::FreeRegion {
scope: fn_def_id,
bound_region: ty::BoundRegion::BrNamed(region_def_id.to_def_id(), name),
bound_region: ty::BoundRegionKind::BrNamed(region_def_id.to_def_id(), name),
}));
f(liberated_region);
}