Remove span from BrAnon.
This commit is contained in:
parent
ded1a8b026
commit
26cb34cd18
39 changed files with 76 additions and 107 deletions
|
@ -354,7 +354,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
|
|||
})
|
||||
}
|
||||
|
||||
ty::BoundRegionKind::BrAnon(..) => None,
|
||||
ty::BoundRegionKind::BrAnon => None,
|
||||
},
|
||||
|
||||
ty::ReLateBound(..)
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_middle::mir::visit::{MutVisitor, TyContext};
|
|||
use rustc_middle::mir::{Body, ConstOperand, Location, Promoted};
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_span::Symbol;
|
||||
|
||||
/// Replaces all free regions appearing in the MIR with fresh
|
||||
/// inference variables, returning the number of variables created.
|
||||
|
@ -28,21 +28,15 @@ pub fn renumber_mir<'tcx>(
|
|||
renumberer.visit_body(body);
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
pub(crate) enum BoundRegionInfo {
|
||||
Name(Symbol),
|
||||
Span(Span),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
pub(crate) enum RegionCtxt {
|
||||
Location(Location),
|
||||
TyContext(TyContext),
|
||||
Free(Symbol),
|
||||
Bound(BoundRegionInfo),
|
||||
LateBound(BoundRegionInfo),
|
||||
Bound(Symbol),
|
||||
LateBound(Symbol),
|
||||
Existential(Option<Symbol>),
|
||||
Placeholder(BoundRegionInfo),
|
||||
Placeholder(Symbol),
|
||||
Unknown,
|
||||
}
|
||||
|
||||
|
|
|
@ -1367,14 +1367,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
}
|
||||
};
|
||||
let (sig, map) = tcx.replace_late_bound_regions(sig, |br| {
|
||||
use crate::renumber::{BoundRegionInfo, RegionCtxt};
|
||||
use crate::renumber::RegionCtxt;
|
||||
|
||||
let region_ctxt_fn = || {
|
||||
let reg_info = match br.kind {
|
||||
ty::BoundRegionKind::BrAnon(Some(span)) => BoundRegionInfo::Span(span),
|
||||
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(sym::anon),
|
||||
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
|
||||
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
|
||||
ty::BoundRegionKind::BrAnon => sym::anon,
|
||||
ty::BoundRegionKind::BrNamed(_, name) => name,
|
||||
ty::BoundRegionKind::BrEnv => sym::env,
|
||||
};
|
||||
|
||||
RegionCtxt::LateBound(reg_info)
|
||||
|
|
|
@ -11,7 +11,7 @@ use rustc_span::{Span, Symbol};
|
|||
|
||||
use crate::constraints::OutlivesConstraint;
|
||||
use crate::diagnostics::UniverseInfo;
|
||||
use crate::renumber::{BoundRegionInfo, RegionCtxt};
|
||||
use crate::renumber::RegionCtxt;
|
||||
use crate::type_check::{InstantiateOpaqueType, Locations, TypeChecker};
|
||||
|
||||
impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
|
@ -126,10 +126,9 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
|
|||
.placeholder_region(self.type_checker.infcx, placeholder);
|
||||
|
||||
let reg_info = match placeholder.bound.kind {
|
||||
ty::BoundRegionKind::BrAnon(Some(span)) => BoundRegionInfo::Span(span),
|
||||
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(sym::anon),
|
||||
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
|
||||
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
|
||||
ty::BoundRegionKind::BrAnon => sym::anon,
|
||||
ty::BoundRegionKind::BrNamed(_, name) => name,
|
||||
ty::BoundRegionKind::BrEnv => sym::env,
|
||||
};
|
||||
|
||||
if cfg!(debug_assertions) {
|
||||
|
|
|
@ -28,7 +28,7 @@ use rustc_span::symbol::{kw, sym};
|
|||
use rustc_span::Symbol;
|
||||
use std::iter;
|
||||
|
||||
use crate::renumber::{BoundRegionInfo, RegionCtxt};
|
||||
use crate::renumber::RegionCtxt;
|
||||
use crate::BorrowckInferCtxt;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -446,9 +446,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
if !indices.indices.contains_key(&r) {
|
||||
let region_vid = {
|
||||
let name = r.get_name_or_anon();
|
||||
self.infcx.next_nll_region_var(FR, || {
|
||||
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
|
||||
})
|
||||
self.infcx.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
|
||||
};
|
||||
|
||||
debug!(?region_vid);
|
||||
|
@ -480,9 +478,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
if !indices.indices.contains_key(&r) {
|
||||
let region_vid = {
|
||||
let name = r.get_name_or_anon();
|
||||
self.infcx.next_nll_region_var(FR, || {
|
||||
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
|
||||
})
|
||||
self.infcx.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
|
||||
};
|
||||
|
||||
debug!(?region_vid);
|
||||
|
@ -796,7 +792,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
|
|||
_ => sym::anon,
|
||||
};
|
||||
|
||||
self.next_nll_region_var(origin, || RegionCtxt::Bound(BoundRegionInfo::Name(name)))
|
||||
self.next_nll_region_var(origin, || RegionCtxt::Bound(name))
|
||||
};
|
||||
|
||||
indices.insert_late_bound_region(liberated_region, region_vid.as_var());
|
||||
|
@ -826,9 +822,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
|
|||
if !indices.indices.contains_key(&r) {
|
||||
let region_vid = {
|
||||
let name = r.get_name_or_anon();
|
||||
self.next_nll_region_var(FR, || {
|
||||
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
|
||||
})
|
||||
self.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
|
||||
};
|
||||
|
||||
debug!(?region_vid);
|
||||
|
@ -848,9 +842,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
|
|||
if !indices.indices.contains_key(&r) {
|
||||
let region_vid = {
|
||||
let name = r.get_name_or_anon();
|
||||
self.next_nll_region_var(FR, || {
|
||||
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
|
||||
})
|
||||
self.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
|
||||
};
|
||||
|
||||
indices.insert_late_bound_region(r, region_vid.as_var());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue